-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix #37740: Cast all Request parameter values to string #37755
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
Fix #37740: Cast all Request parameter values to string #37755
Conversation
2caf49e
to
7ef6a60
Compare
This is not the right fix for the issue. For instance, The right fix must be implemented in the conversion layer between BrowserKit and HttpFoundation, for the query and request parameters only. |
Do you mean here? symfony/src/Symfony/Component/HttpFoundation/Request.php Lines 391 to 396 in 786ba10
I can put the casting right before the switch/case |
No. This place is still in the HttpFoundation request object itself (which might add overhead the handling of actual web requests btw). This should either be done when creating the BrowserKit request (might make sense as other BrowserKit implementations would also not be able to submit non-string values), or when converting from one to the other in symfony/src/Symfony/Component/HttpKernel/HttpKernelBrowser.php Lines 131 to 133 in e1cfbd2
|
It would make most sense to put it in BrowserKit\Request then. |
825b825
to
2592523
Compare
39a3c0d
to
aa891d8
Compare
aa891d8
to
eb6641f
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.
Should target master.
@@ -113,4 +113,13 @@ public function getContent() | |||
{ | |||
return $this->content; | |||
} | |||
|
|||
private static function convertAllValuesToString(array $parameters): array |
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.
Could be inline.
81ada0b
to
eaba19f
Compare
Thank you @rgeraads. |
d3aaf3e
to
d4e2cec
Compare
Am I just wondering in addition to fix the "null" issue (that is good), why this modified behavior for parameters I passed as POST request? Input request parameters After array:8 [ Input validation for request Response: |
And answer to my own question (for anyone who had the same issue) is not using "params" here that used for application/x-www-form-urlencoded, but using a body with JSON encoded parameters and a proper header. Before:
After:
|
This fix ensures that all parameter values in Browserkit\Request are received as strings on the receiving end.