-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[php] Fix JSON object deserialization #8481
[php] Fix JSON object deserialization #8481
Conversation
Hello @ybelenko, around line 222, responses section:
and then we do the same thing around line 241, and something similar in the Async method as well. This works because json_decode() will convert '1.2' to (float)1.2, 'true' to (bool)true and, of course, a json string to an object/array. This way, the serializer will never receive encoded data, and everything works as it should! :) I'd recommend this change over the suggested one: the deserialize() method is recursive, and this error can only happen when it is called from the API. Adding the fix to it will make it do unnecessary checks for every recursion, while we only need to guarantee that the first call receives valid data... Cheers! :) |
This reverts commit 42a4637e53020d8d3e921f72bc66de9d4ccd8151.
a3a79cc
to
5ee86eb
Compare
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.
Thanks for the new push! :)
But you need to replicate this change also on lines 244 and 259 :)
Cheers! :)
Sorry, seems like I'm not following anymore(line 259). Please, push commit yourself or give me exact diff. |
My bad, @ybelenko, I gave you the wrong line ref! :)
Cheers! |
@thomasphansen thanks for approve, but I guess we need to wait @wing328 since he showed interest in this bugfix. |
@dkarlovi didn't you face that issue with PHP client? Maybe you can take a brief look if you have time. |
When I call API via generated PHP client I got encoded json string instead of decoded object. Response looks like:
["{\"foobar\":\"foobaz\"}"]
UPD: I've checked response HTTP headers and
Content-Type: application/json
has been set correctly.Closes #8394
Circle-CI fail log:
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
,5.1.x
,6.0.x
@jebentier, @dkarlovi, @mandrean, @jfastnacht, @ackintosh, @renepardon