-
-
Notifications
You must be signed in to change notification settings - Fork 46
Symfony (http foundation) request->getRequestUri() doesn't contain query string #268
Comments
Yeah, definitely we should use a proper factory method to create a request object when they're available. Do you want to provide a fix for that issue? @Rastusik |
I looked into it, and I think the first solution is sufficient because there would need to be very similar two lines of code even with the proper factory method usage because the proper factory method needs the manually concatenated path anyway and it also needs a http method as a string parameter which I don't know how to obtain from swoole request, probably from |
Yeah, I think it's worth investigating and probably we should also write a test that proves correct behavior. |
Well, I did the investigation and the second solution would be to use this method: |
* docs(readme): clarify state of HMR in bundle (#275) ([1e49f07](1e49f07)), closes [#275](#275) [#264](#264) * fix(doctrine): autoconfigure EntityManagerHandler only when orm is available in symfony's container ([87ede15](87ede15)), closes [#274](#274) * fix(http): proper creation of $_SERVER['REQUEST_URI'] (#269) ([78bb42b](78bb42b)), closes [#269](#269) * test(issue-268): add e2e test to ensure no regressions (#273) ([b9df907](b9df907)), closes [#273](#273) [#268](#268) * build(deps-dev): bump friendsofphp/php-cs-fixer from 2.16.3 to 2.16.4 (#266) ([7acabd7](7acabd7)), closes [#266](#266) * build(deps-dev): bump phpspec/prophecy-phpunit from 2.0.0 to 2.0.1 (#271) ([623923d](623923d)), closes [#271](#271) * build(deps-dev): bump phpstan/phpstan from 0.12.30 to 0.12.31 (#265) ([4c750a7](4c750a7)), closes [#265](#265) * build(deps-dev): bump phpstan/phpstan from 0.12.31 to 0.12.32 (#267) ([334b88f](334b88f)), closes [#267](#267) * build(deps-dev): bump phpunit/phpunit from 9.2.5 to 9.2.6 (#272) ([2256702](2256702)), closes [#272](#272)
Describe the bug
The creation of Http Request in the
RequestFactory
doesn't set the$_SERVER[REQUEST_URI]
parameter to the$server
variable, which results in wrong value returned by calling$request->getRequestUri()
.Steps To Reproduce
When a Symfony app with swoole bundle with gets requested with an url like this:
http://localhost:9501/twig?test=abc&wtf=123
, calling$request->getRequestUri()
somewhere in the code, will return '/twig'.Expected behavior
The method call should return this value:
/twig?test=abc&wtf=123
Reference in symfony's Http/Request code: https://github.com/symfony/http-foundation/blob/1b66b861f3ff55fb39c13822a0fc915018b5ac84/Request.php#L1005
Environment (please complete the following information):
Proposed fix
The bug happens because this line: https://github.com/symfony/http-foundation/blob/v5.1.1/Request.php#L413 isn't called by creating the Request instance in the
RequestsFactory
One solution would be to add these two lines into the factory:
Another solution would be to call Request::create(), instead of just calling the Request class constructor directly.
The text was updated successfully, but these errors were encountered: