Skip to content

Commit c6c528c

Browse files
committed
decodes some special chars in a URL query
1 parent 8e42756 commit c6c528c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/Symfony/Component/Routing/Generator/UrlGenerator.php

+1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa
279279
// add a query string if needed
280280
$extra = array_diff_key($parameters, $variables, $defaults);
281281
if ($extra && $query = http_build_query($extra, '', '&')) {
282+
$query = strtr($query, $this->decodedChars);
282283
$url .= '?'.$query;
283284
}
284285

src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public function testUrlEncoding()
331331
$routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+')));
332332
$this->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
333333
.'/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id'
334-
.'?query=%40%3A%5B%5D%2F%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id',
334+
.'?query=@:%5B%5D/%28%29*%27%22++,;-._%7E%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id',
335335
$this->getGenerator($routes)->generate('test', array(
336336
'varpath' => $chars,
337337
'query' => $chars,

0 commit comments

Comments
 (0)