[HttpKernel] UriSigner::buildUrl - default params for http_build_query

This commit is contained in:
Jakub Simon 2015-03-16 21:39:42 +01:00 committed by Fabien Potencier
parent 9b1eee161d
commit 3d6933f00c
2 changed files with 13 additions and 1 deletions

View File

@ -36,4 +36,16 @@ class UriSignerTest extends \PHPUnit_Framework_TestCase
$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')));
}
}

View File

@ -92,7 +92,7 @@ class UriSigner
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'] : '';