You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
… when denormalizing (thijsBreker)
This PR was merged into the 5.4 branch.
Discussion
----------
[Serializer] Take unnamed variadic parameters into account when denormalizing
We shouldn't break when a constructor has variadic parameters without named keys in the array.
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#53354
| License | MIT
Commits
-------
cbecdfe [Serializer] Take unnamed variadic parameters into account when denormalizing
Symfony version(s) affected
6.4.2 (Other versions most likely as well)
Description
For some reason the serializer doesn't seem to like variadic arguments in the constructor
How to reproduce
When deserializing a json object like this
into a PHP class like this
I get the PHP error
Error : Cannot use positional argument after named argument
on line 429 ofAbstractNormalizer.php
.Possible Solution
When I wrap the
$params
variable in anarray_values()
call the problem goes away. I'll try to create a pull request with my fix later.Additional Context
No response
The text was updated successfully, but these errors were encountered: