Skip to content

Commit 0169c76

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Run intl-data tests on resources change [FrameworkBundle] fix preserving some special chars in the query string when redirecting
2 parents 115cd20 + 38f86be commit 0169c76

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Controller/RedirectController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private static function parseQuery(string $query)
212212
if (false === $i = strpos($k, '[')) {
213213
$q[] = bin2hex($k).$v;
214214
} else {
215-
$q[] = substr_replace($k, bin2hex(substr($k, 0, $i)), 0, $i).$v;
215+
$q[] = bin2hex(substr($k, 0, $i)).rawurlencode(substr($k, $i)).$v;
216216
}
217217
}
218218

Tests/Controller/RedirectControllerTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,19 @@ public function testRedirectWithQuery()
302302
$baseUrl = '/base';
303303
$port = 80;
304304

305-
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza');
305+
$request = $this->createRequestObject($scheme, $host, $port, $baseUrl, 'b.se=zaza&f[%2525][%26][%3D][p.c]=d');
306306
$request->attributes = new ParameterBag(['_route_params' => ['base2' => 'zaza']]);
307307
$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
308-
$urlGenerator->expects($this->exactly(2))->method('generate')->willReturn('/test?b.se=zaza&base2=zaza')->with('/test', ['b.se' => 'zaza', 'base2' => 'zaza'], UrlGeneratorInterface::ABSOLUTE_URL);
308+
$urlGenerator->expects($this->exactly(2))
309+
->method('generate')
310+
->willReturn('/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d')
311+
->with('/test', ['b.se' => 'zaza', 'base2' => 'zaza', 'f' => ['%25' => ['&' => ['=' => ['p.c' => 'd']]]]], UrlGeneratorInterface::ABSOLUTE_URL);
309312

310313
$controller = new RedirectController($urlGenerator);
311-
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zaza&base2=zaza');
314+
$this->assertRedirectUrl($controller->redirectAction($request, '/test', false, false, false, true), '/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d');
312315

313316
$request->attributes->set('_route_params', ['base2' => 'zaza', 'route' => '/test', 'ignoreAttributes' => false, 'keepRequestMethod' => false, 'keepQueryParams' => true]);
314-
$this->assertRedirectUrl($controller($request), '/test?b.se=zaza&base2=zaza');
317+
$this->assertRedirectUrl($controller($request), '/test?b.se=zaza&base2=zaza&f[%2525][%26][%3D][p.c]=d');
315318
}
316319

317320
public function testRedirectWithQueryWithRouteParamsOveriding()

0 commit comments

Comments
 (0)