Skip to content

Commit

Permalink
[HttpKernel] UriSigner::buildUrl - default params for http_build_query
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Simon authored and fabpot committed Mar 17, 2015
1 parent faf449b commit ad8fe2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Tests/UriSignerTest.php
Expand Up @@ -36,4 +36,16 @@ public function testCheck()

$this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
}

public function testCheckWithDifferentArgSeparator()
{
$this->iniSet('arg_separator.output', '&');
$signer = new UriSigner('foobar');

$this->assertSame(
"http://example.com/foo?baz=bay&foo=bar&_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D",
$signer->sign('http://example.com/foo?foo=bar&baz=bay')
);
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay')));
}
}
2 changes: 1 addition & 1 deletion UriSigner.php
Expand Up @@ -92,7 +92,7 @@ private function computeHash($uri)
private function buildUrl(array $url, array $params = array())
{
ksort($params);
$url['query'] = http_build_query($params);
$url['query'] = http_build_query($params, '', '&');

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

0 comments on commit ad8fe2e

Please sign in to comment.