Skip to content

Commit ad8fe2e

Browse files
Jakub Simonfabpot
authored andcommitted
[HttpKernel] UriSigner::buildUrl - default params for http_build_query
1 parent faf449b commit ad8fe2e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Tests/UriSignerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@ public function testCheck()
3636

3737
$this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
3838
}
39+
40+
public function testCheckWithDifferentArgSeparator()
41+
{
42+
$this->iniSet('arg_separator.output', '&');
43+
$signer = new UriSigner('foobar');
44+
45+
$this->assertSame(
46+
"http://example.com/foo?baz=bay&foo=bar&_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D",
47+
$signer->sign('http://example.com/foo?foo=bar&baz=bay')
48+
);
49+
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay')));
50+
}
3951
}

UriSigner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private function computeHash($uri)
9292
private function buildUrl(array $url, array $params = array())
9393
{
9494
ksort($params);
95-
$url['query'] = http_build_query($params);
95+
$url['query'] = http_build_query($params, '', '&');
9696

9797
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
9898
$host = isset($url['host']) ? $url['host'] : '';

0 commit comments

Comments
 (0)