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

[Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument #28825

Closed
karser opened this issue Oct 11, 2018 · 0 comments

Comments

@karser
Copy link
Contributor

karser commented Oct 11, 2018

Symfony version(s) affected: 4.2-dev and previous

Description

if class accepts array of objects in constructor It doesn't recognize the argument type hint from phpdoc and deserializes it as a plain array.

How to reproduce

I created DeserializeNestedArrayOfObjectsTest that reproduces the issue.

Additional context
Here is Zoo class (without constructor). Animal object is deserialized as expected:
image

Then there is ZooImmutable (with constructor), an array given instead of Animal object: <- BUG
image

karser added a commit to karser/symfony that referenced this issue Dec 7, 2018
fabpot added a commit that referenced this issue Dec 10, 2018
…e hint from phpdoc for array in constructor argument (karser)

This PR was squashed before being merged into the 3.4 branch (closes #29513).

Discussion
----------

[Hackday][Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument

| Q             | A
| ------------- | ---
| Branch?       | 3.4 and up to 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #28825
| License       | MIT

This is a fix of #28825 big thanks @dunglas and @xabbuh

Commits
-------

8741d00 [Hackday][Serializer] Deserialization ignores argument type hint from phpdoc for array in constructor argument
@fabpot fabpot closed this as completed Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants