-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Serializer] Cast numeric/null into xml node value to php type instead of string #34901
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
e4337ff
to
e6c4e4a
Compare
This looks like a behavior change: not sure it qualifies as a new feature. It's either a bug fix or a potential BC break to me. |
@nicolas-grekas Yes i understand. What do you think if i created a new context key |
bd3ff8e
to
ef60917
Compare
9840d27
to
a26aaae
Compare
Update to add in same way the null cast. XML example: <?xml version="1.0"?>
<response>
<foo/>
</response> Currently: array(2) {
["foo"]=>
string(0) ""
} expected array(2) {
["foo"]=>
null
} |
a26aaae
to
967f070
Compare
I would rather change validateAndDenormalize to accept casting strings to int|float when a numeric string is encountered. Can you please have a look ? |
Any news here? |
@nicolas-grekas Hello, Sorry for answer time. |
I think I'm 👎 here: this is not the proper place to do this. Instead, the casting logic should happen in the code that uses the resulting array to hydrate the target structure - by looking at the metadata of the target structure (as suggested in api-platform/core#3192) |
Let's close then. |
XML example:
Currently:
expected