Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Fix jsonRequest inAbstractBrowser for GET methods#39281
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Fix jsonRequest inAbstractBrowser for GET methods#39281
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cc1747f to4d90a87Compare4d90a87 to589d06fCompareUh oh!
There was an error while loading.Please reload this page.
alexander-schranz commentedJan 8, 2021
@nicolas-grekas anything missing here from my side? |
nicolas-grekas left a comment
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.
(failures are false-positives)
| break; | ||
| default: | ||
| $content =null; | ||
| $query =$parameters; |
nicolas-grekasJan 26, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
wait, I'm not sure anymore that this makes sense:$parameters doesn't go through the processing ofjson_encode().
That means objects (that do or don't implementJsonSerializable) are going to be passed differently when usingGET vs other verbs.
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.
Yeah based on the method we set it a request body or not. This is based on the linked logic which symfony currently use here:https://github.com/symfony/symfony/blob/v5.2.0/src/Symfony/Component/HttpFoundation/Request.php#L388-L404
It does not make sense to convert query parameters to JSON as nobody will converted it back. Which is in the FosRestBundle and ApiPlatform converted into the$request->request attributes by theBodyListener.
alexander-schranz commentedApr 26, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@nicolas-grekas any update to this I think this still should match the same logic as the http foundation |
AbstractBrowser for GET methodsalexander-schranz commentedMay 19, 2022
@nicolas-grekas I still think this change is valid because of: symfony/src/Symfony/Component/HttpFoundation/Request.php Lines 375 to 391 ind303433
And because of GET, HEAD, OPTION parameters are query strings and the content has no meaning:https://stackoverflow.com/questions/978061/http-get-with-request-body But think this will not being merged as it is now open a long time? |
AbstractBrowser for GET methodsAbstractBrowser for GET methodsnicolas-grekas commentedFeb 21, 2023
I think nobody understands the change :) |
Uh oh!
There was an error while loading.Please reload this page.
When implementing#38596 I was not aware of that $parameters are also used as queryParameters and are converted based on the Methodhere into query or request data. This I think should be handled the same way for the jsonRequest also instead of just unset the server variables we should to reset to the predefined server variables.