diff --git a/cake/libs/router.php b/cake/libs/router.php index 77443b3cb..35c9ad9ba 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -1074,7 +1074,7 @@ class Router extends Object { $out = $q; $q = $extra; } - $out .= http_build_query($q); + $out .= http_build_query($q, null, '&'); if (strpos($out, '?') !== 0) { $out = '?' . $out; } diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 03e570ae7..96dc183e9 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -896,6 +896,13 @@ class RouterTest extends UnitTestCase { $expected .= '&more=test+data'; $result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data'))); $this->assertEqual($result, $expected); + + // Test bug #4614 + $restore = ini_get('arg_separator.output'); + ini_set('arg_separator.output', '&'); + $result = Router::url(array('controller' => 'posts', 'action'=>'index', '0', '?' => array('var' => 'test', 'var2' => 'test2', 'more' => 'test data'))); + $this->assertEqual($result, $expected); + ini_set('arg_separator.output', $restore); } function testNamedArgsUrlGeneration() {