Added sort order SORT_STRING for params in UriSigner

This commit is contained in:
Tim van Densen 2016-01-07 10:55:58 +01:00 committed by Fabien Potencier
parent f9bf3f8d5a
commit 2040139db6
2 changed files with 3 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class UriSignerTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($signer->check($signer->sign('http://example.com/foo')));
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar')));
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&0=integer')));
$this->assertTrue($signer->sign('http://example.com/foo?foo=bar&bar=foo') === $signer->sign('http://example.com/foo?bar=foo&foo=bar'));
}

View File

@ -91,8 +91,8 @@ class UriSigner
private function buildUrl(array $url, array $params = array())
{
ksort($params);
$url['query'] = http_build_query($params);
ksort($params, SORT_STRING);
$url['query'] = http_build_query($params, '', '&');
$scheme = isset($url['scheme']) ? $url['scheme'].'://' : '';
$host = isset($url['host']) ? $url['host'] : '';