Skip to content

Commit 5a45b60

Browse files
Merge branch '3.4' into 4.4
* 3.4: [3.4] Fix support for PHP8 union types [PhpUnitBridge] Streamline ansi/no-ansi of composer according to phpunit --colors option [3.4] Small update in our internal terminology [Cache] fix compat with DBAL v3 [VarDumper] Fix CliDumper coloration [DI] tighten detection of local dirs to prevent false positives [FrameworkBundle] preserve dots in query-string when redirecting bumped Symfony version to 3.4.43 updated VERSION for 3.4.42 update CONTRIBUTORS for 3.4.42 updated CHANGELOG for 3.4.42
2 parents 7da157f + 4533624 commit 5a45b60

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

Controller/RedirectController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ public function urlRedirectAction(Request $request, string $path, bool $permanen
117117
$scheme = $request->getScheme();
118118
}
119119

120-
$qs = $request->getQueryString();
121-
if ($qs) {
120+
if ($qs = $request->server->get('QUERY_STRING') ?: $request->getQueryString()) {
122121
if (false === strpos($path, '?')) {
123122
$qs = '?'.$qs;
124123
} else {

Tests/Controller/RedirectControllerTest.php

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ public function pathQueryParamsProvider()
267267
return [
268268
['http://www.example.com/base/redirect-path', '/redirect-path', ''],
269269
['http://www.example.com/base/redirect-path?foo=bar', '/redirect-path?foo=bar', ''],
270-
['http://www.example.com/base/redirect-path?foo=bar', '/redirect-path', 'foo=bar'],
271-
['http://www.example.com/base/redirect-path?foo=bar&abc=example', '/redirect-path?foo=bar', 'abc=example'],
272-
['http://www.example.com/base/redirect-path?foo=bar&abc=example&baz=def', '/redirect-path?foo=bar', 'abc=example&baz=def'],
270+
['http://www.example.com/base/redirect-path?f.o=bar', '/redirect-path', 'f.o=bar'],
271+
['http://www.example.com/base/redirect-path?f.o=bar&a.c=example', '/redirect-path?f.o=bar', 'a.c=example'],
272+
['http://www.example.com/base/redirect-path?f.o=bar&a.c=example&b.z=def', '/redirect-path?f.o=bar', 'a.c=example&b.z=def'],
273273
];
274274
}
275275

@@ -353,29 +353,20 @@ public function testAmbiguousPathAndRouteParameter()
353353

354354
private function createRequestObject($scheme, $host, $port, $baseUrl, $queryString = '')
355355
{
356-
$request = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')->getMock();
357-
$request
358-
->expects($this->any())
359-
->method('getScheme')
360-
->willReturn($scheme);
361-
$request
362-
->expects($this->any())
363-
->method('getHost')
364-
->willReturn($host);
365-
$request
366-
->expects($this->any())
367-
->method('getPort')
368-
->willReturn($port);
369-
$request
370-
->expects($this->any())
371-
->method('getBaseUrl')
372-
->willReturn($baseUrl);
373-
$request
374-
->expects($this->any())
375-
->method('getQueryString')
376-
->willReturn($queryString);
377-
378-
return $request;
356+
if ('' !== $queryString) {
357+
parse_str($queryString, $query);
358+
} else {
359+
$query = [];
360+
}
361+
362+
return new Request($query, [], [], [], [], [
363+
'HTTPS' => 'https' === $scheme,
364+
'HTTP_HOST' => $host.($port ? ':'.$port : ''),
365+
'SERVER_PORT' => $port,
366+
'SCRIPT_FILENAME' => $baseUrl,
367+
'REQUEST_URI' => $baseUrl,
368+
'QUERY_STRING' => $queryString,
369+
]);
379370
}
380371

381372
private function createRedirectController($httpPort = null, $httpsPort = null)

0 commit comments

Comments
 (0)