-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Fix keep_as_list
when data is not an array
#60638
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
base: 7.2
Are you sure you want to change the base?
Conversation
945573e
to
86b5597
Compare
keeping tests using |
If we only want to test against Doctrine collections maybe the |
@MatTheCat I did not say "only" in my message. But keeping a test using ArrayCollection brings value to our testsuite, even if it implies a dev dependency on |
86b5597
to
643592f
Compare
Okay kept the existing test against |
643592f
to
4433af8
Compare
4433af8
to
1f4dd71
Compare
The
CollectionType
handles not only arrays but alsoArrayAccess&Traversable
. However when setting itskeep_as_list
option,array_values
would then be called and crash.To avoid this, this PR reindexes the data by getting its keys and unsetting them. This is because unsetting in a loop can produce counter-intuitive results; e.g.
ArrayIterator
would skip indexes.Note that #57430 mentions another issue that would be fixed by #59910.