Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Forward Form::submit(Request) to Form::HandleRequest#16088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…eRequestWhen the argument of Form::submit is a Request object it forwards toForm::HandleRequest.Fixes the issue with uploaded files exceeding post_max_size,and form marked valid with empty fields.
Tobion commentedOct 2, 2015
|
Tobion commentedOct 2, 2015
I think the actual problem is that#11924 fixed the request handlers, but did not fix the legacy appraoch using thehttps://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php |
src/Symfony/Component/Form/Form.php Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this should be moved after thethrow new AlreadySubmittedException
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
also you need to skip the following code in this case because the request handler itself also callssubmit. seehttps://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php#L116
so otherwise the form would be submitted twice and an AlreadySubmittedException is thrown.
have you actually tried to use the fix for your issue? it cannot work in its current form AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It shouldn't throw the AlreadySubmittedException, because it follows a different execution path inside submit()
1 Form::submit(Request)
1.1 Form::handleRequest(Request)
1.1.1 HttpFoundationRequestHandler::handleRequest(Form, Request)
1.1.1.1 Form::submit(data)
only at: 1.1.1.1 Form::submitted = true
And if we used bind
preBindEvent dispatches (does not submit, so submitted is still false)
bind will call Form::submit(Request) which will follow the same execution path above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
ah there is areturn in front of handleRequest. I didn't see that and this is what I thought is missing.
fabpot commentedOct 6, 2015
@Tobion Does it get a +1 from you? |
Tobion commentedOct 6, 2015
Hm I see one problem. When using So I think the only non-breaking solution is to fix thehttps://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php according tohttps://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php. |
Tobion commentedOct 6, 2015
But then again, this approach is deprecated anyway. So I'm not sure it's really worth to do it. |
When the argument of Form::submit is a Request object it forwards to Form::HandleRequest.
Fixes the issue with uploaded files exceeding post_max_size,
and form marked as valid with empty fields.