Skip to content
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

[Form] [EventListener] fixed sending non array data on preSubmit to ResizeFormListener #13851

Closed
wants to merge 1 commit into from

Conversation

BruceWouaigne
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #13804
License MIT
Doc PR -

@@ -145,7 +145,7 @@ public function onSubmit(FormEvent $event)
}

if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)');
$data = array();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done in the preSubmit method instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed

@BruceWouaigne BruceWouaigne changed the title [Form] [EventListener] fixed sending non array data on submit to ResizeFormListener [Form] [EventListener] fixed sending non array data on preSubmit to ResizeFormListener Mar 5, 2015
@Tobion
Copy link
Member

Tobion commented Jun 5, 2015

Would seem more natural to me if onSubmit would also ignore invalid data.

@Tobion
Copy link
Member

Tobion commented Jun 5, 2015

And it should be merged in 2.3

@xabbuh
Copy link
Member

xabbuh commented Jun 11, 2015

Would seem more natural to me if onSubmit would also ignore invalid data.

FormEvent::getData() returns the normalised data in the SUBMIT event. Malformed data cannot be triggered by the request data, right? I don't think it makes sense to simply ignore it here.

@xabbuh xabbuh added the Form label Jun 11, 2015
@webmozart
Copy link
Contributor

Thanks for working on this @BruceWouaigne! Looks good to me.

@BruceWouaigne
Copy link
Contributor Author

Awesome! Thanks :)

@Tobion
Copy link
Member

Tobion commented Jun 18, 2015

The other fixes of this kind have been merged into 2.3. So merging this into 2.8 seems wrong to me.

fabpot added a commit that referenced this pull request Jun 27, 2015
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants