10000 [Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily by issei-m · Pull Request #21267 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fix ChoiceType to ensure submitted data is not nested unnecessarily #21267

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

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update comment
  • Loading branch information
issei-m committed Feb 9, 2017
commit eb4d85a0ed0dc52c389f733f6eda367e05a13850
4 changes: 2 additions & 2 deletions src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->addEventSubscriber(new MergeCollectionListener(true, true));
}

// To avoid some problem against treating of array (e.g. Array to string conversion),
// we have to first ensure the all elements of submitted data ain't an array.
// To avoid issues when the submitted choices are arrays (i.e. array to string conversions),
// we have to ensure that all elements of the submitted choice data are strings or null.
$builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) {
$data = $event->getData();

Expand Down
0