Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged

Conversation

yguedidi
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

@yguedidi
Copy link
Contributor Author

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, '&')));
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

@fabpot
Copy link
Member

fabpot commented Aug 8, 2014

👍

2 similar comments
@nicolas-grekas
Copy link
Member

👍

@romainneutron
Copy link
Contributor

👍

@nicolas-grekas
Copy link
Member

Thanks for fixing this bug @yguedidi.

@nicolas-grekas nicolas-grekas merged commit 777666f into symfony:2.3 Aug 13, 2014
nicolas-grekas added a commit that referenced this pull request Aug 13, 2014
…(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
@yguedidi
Copy link
Contributor Author

@nicolas-grekas You're welcome.

@yguedidi yguedidi deleted the update-query-string-when-override branch August 14, 2014 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants