-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Update QUERY_STRING when overrideGlobals #11408
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
[HttpFoundation] Update QUERY_STRING when overrideGlobals #11408
Conversation
yguedidi
commented
Jul 17, 2014
Q | A |
---|---|
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | - |
License | MIT |
Doc PR | - |
ping @fabpot |
@@ -479,6 +479,8 @@ public function __toString() | |||
*/ | |||
public function overrideGlobals() | |||
{ | |||
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&'))); |
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 probably be $_SERVER['QUERY_STRING'] = static::...
instead (and moved after the main $_SERVER
assignation). But I don't see why this would be needed.
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.
A use case is when you want to get the current URI without some GET parameters:
$request->query->remove('nonce');
$redirectUri = $request->getUri();
I code it like this at the first position because getUri()
uses getQueryString()
that gets the query string from $this->server
.
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.
@fabpot does this need something else?
👍 |
2 similar comments
👍 |
👍 |
Thanks for fixing this bug @yguedidi. |
…(yguedidi) This PR was merged into the 2.3 branch. Discussion ---------- [HttpFoundation] Update QUERY_STRING when overrideGlobals | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 777666f [HttpFoundation] Update QUERY_STRING when overrideGlobals
@nicolas-grekas You're welcome. |