-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Fix denormalizing nested arrays as object values #30258
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
Conversation
@@ -52,6 +52,13 @@ public function denormalize($data, $class, $format = null, array $context = []) | |||
$class = substr($class, 0, -2); | |||
|
|||
$builtinType = isset($context['key_type']) ? $context['key_type']->getBuiltinType() : null; | |||
|
|||
// Fix a collection that contains the only one element | |||
// This is special to xml format only |
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 fix was in ObjectNormalizer, I think it makes more sense here, and now with the recursive types its harder to fit into ObjectNormalizer.
784b9f0
to
9c93527
Compare
fa2065a
to
f42b39e
Compare
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
Outdated
Show resolved
Hide resolved
f42b39e
to
b87b268
Compare
@nicolas-grekas Resolved all the comments, also rebased on 4.3 |
b87b268
to
820c052
Compare
820c052
to
952527d
Compare
@mcfedr I think we lost track of this PR, and the code changed now, so that there is a conflict to resolve. Could you please rebase this PR on 4.4? |
Closing because this stalled, but more importantly because this might have been fixed in #32832 already. |
Currently the ObjectNormalizer loses type information for nested arrays in its properties, resulting in failed denormalization
Basically if i have this property
The ObjectNormalizer just sees this as a 'array' type and injects the raw array, rather than passing it back to the Serializer with class
Child[][]