From 2040139db6c6108aed91fbafa606619a3bcb9ba4 Mon Sep 17 00:00:00 2001 From: Tim van Densen Date: Thu, 7 Jan 2016 10:55:58 +0100 Subject: [PATCH] Added sort order SORT_STRING for params in UriSigner --- src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php | 1 + src/Symfony/Component/HttpKernel/UriSigner.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php index b66014d849..37a1d2fe93 100644 --- a/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/UriSignerTest.php @@ -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')); } diff --git a/src/Symfony/Component/HttpKernel/UriSigner.php b/src/Symfony/Component/HttpKernel/UriSigner.php index d77d27430d..5a96ef2228 100644 --- a/src/Symfony/Component/HttpKernel/UriSigner.php +++ b/src/Symfony/Component/HttpKernel/UriSigner.php @@ -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'] : '';