-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Sending non array causes UnexpectedTypeException #13804
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think the behaviour is correct at the moment. You're trying to submit a string instead of a collection. This is unexpected and an exception seems appropriate. |
The behavior is not correct when an exception is thrown. I already fixed some of those problems in the past where users can throw internal exceptions by submitting unexpected data. This should not be possible. It should either ignore the data or add a form validation error. |
@Tobion makes sense. I missed your previous PRs. |
Should I do something specific for someone to merge the PR? |
@BruceWouaigne Which PR do you refer to? Edit: never mind, got it |
…Submit to ResizeFormListener (BruceWouaigne) This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #13851). Discussion ---------- [Form] [EventListener] fixed sending non array data on preSubmit to ResizeFormListener | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13804 | License | MIT | Doc PR | - Commits ------- 74d794b [Form] [EventListener] fixed sending non array data on submit to ResizeListener
Fixed in #13851. |
…tener (BruceWouaigne) This PR was merged into the 2.3 branch. Discussion ---------- [Form] fixed sending non array data on submit to ResizeListener | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #13804, #13851 | License | MIT | Doc PR | I agree with @Tobion that #13851 is a bug fix and therefore should be applied on the `2.3` branch too. Commits ------- 0f185c9 [Form] [EventListener] fixed sending non array data on submit to ResizeListener
Hi guys,
I just notice that, when I send a non array data to a collection form field the
ResizeFormListener
throws anUnexpectedTypeException
before the form validation.Here is the action
And the form
Is there anything that I can do to avoid this? By this I mean to get a non valid form instead of an Exception...
I don't really get why https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php#L147 should throws an Exception instead of doing a
$data = [];
or something.What do you think?
The text was updated successfully, but these errors were encountered: