Skip to content

Commit

Permalink
minor #26233 Clean calls to http_build_query() (nicolas-grekas)
Browse files Browse the repository at this point in the history
This PR was merged into the 2.7 branch.

Discussion
----------

Clean calls to http_build_query()

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

Commits
-------

4055224 Clean calls to http_build_query()
  • Loading branch information
nicolas-grekas committed Feb 19, 2018
2 parents 820ad07 + 4055224 commit 862e347
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/DomCrawler/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function getUri()
parse_str($query, $currentParameters);
}

$queryString = http_build_query(array_merge($currentParameters, $this->getValues()), null, '&');
$queryString = http_build_query(array_merge($currentParameters, $this->getValues()), '', '&');

$pos = strpos($uri, '?');
$base = false === $pos ? $uri : substr($uri, 0, $pos);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public function __toString()
*/
public function overrideGlobals()
{
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), null, '&')));
$this->server->set('QUERY_STRING', static::normalizeQueryString(http_build_query($this->query->all(), '', '&')));

$_GET = $this->query->all();
$_POST = $this->request->all();
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2065,7 +2065,7 @@ class RequestContentProxy extends Request
{
public function getContent($asResource = false)
{
return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'));
return http_build_query(array('_method' => 'PUT', 'content' => 'mycontent'), '', '&');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function handle(GetResponseEvent $event)
}

$request->query->remove($this->usernameParameter);
$request->server->set('QUERY_STRING', http_build_query($request->query->all()));
$request->server->set('QUERY_STRING', http_build_query($request->query->all(), '', '&'));

$response = new RedirectResponse($request->getUri(), 302);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private function generateLogoutUrl($key, $referenceType)
$url = UrlGeneratorInterface::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;

if (!empty($parameters)) {
$url .= '?'.http_build_query($parameters);
$url .= '?'.http_build_query($parameters, '', '&');
}
} else {
if (!$this->router) {
Expand Down

0 comments on commit 862e347

Please sign in to comment.