diff --git a/lib/Cake/Routing/Router.php b/lib/Cake/Routing/Router.php index 2528db7ea..68d88b73a 100644 --- a/lib/Cake/Routing/Router.php +++ b/lib/Cake/Routing/Router.php @@ -945,9 +945,9 @@ class Router { if (!empty($named)) { foreach ($named as $name => $value) { if (is_array($value)) { - $flattend = Hash::flatten($value, ']['); + $flattend = Hash::flatten($value, '%5D%5B'); foreach ($flattend as $namedKey => $namedValue) { - $output .= '/' . $name . "[$namedKey]" . self::$_namedConfig['separator'] . rawurlencode($namedValue); + $output .= '/' . $name . "%5B{$namedKey}%5D" . self::$_namedConfig['separator'] . rawurlencode($namedValue); } } else { $output .= '/' . $name . self::$_namedConfig['separator'] . rawurlencode($value); diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index c42285f45..b3c65dc56 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -484,7 +484,7 @@ class RouterTest extends CakeTestCase { $result = Router::url(array('controller' => 'tests', 'pages' => array( 1, 2, 3 ))); - $expected = '/tests/index/pages[0]:1/pages[1]:2/pages[2]:3'; + $expected = '/tests/index/pages%5B0%5D:1/pages%5B1%5D:2/pages%5B2%5D:3'; $this->assertEquals($expected, $result); $result = Router::url(array('controller' => 'tests', @@ -496,7 +496,7 @@ class RouterTest extends CakeTestCase { 'three' ) )); - $expected = '/tests/index/pages[param1][0]:one/pages[param1][1]:two/pages[0]:three'; + $expected = '/tests/index/pages%5Bparam1%5D%5B0%5D:one/pages%5Bparam1%5D%5B1%5D:two/pages%5B0%5D:three'; $this->assertEquals($expected, $result); $result = Router::url(array('controller' => 'tests', @@ -508,7 +508,7 @@ class RouterTest extends CakeTestCase { 'three' ) )); - $expected = '/tests/index/pages[param1][one]:1/pages[param1][two]:2/pages[0]:three'; + $expected = '/tests/index/pages%5Bparam1%5D%5Bone%5D:1/pages%5Bparam1%5D%5Btwo%5D:2/pages%5B0%5D:three'; $this->assertEquals($expected, $result); $result = Router::url(array('controller' => 'tests', @@ -520,14 +520,14 @@ class RouterTest extends CakeTestCase { 'cool' ) )); - $expected = '/tests/index/super[nested][array]:awesome/super[nested][something]:else/super[0]:cool'; + $expected = '/tests/index/super%5Bnested%5D%5Barray%5D:awesome/super%5Bnested%5D%5Bsomething%5D:else/super%5B0%5D:cool'; $this->assertEquals($expected, $result); $result = Router::url(array('controller' => 'tests', 'namedParam' => array( 'keyed' => 'is an array', 'test' ))); - $expected = '/tests/index/namedParam[keyed]:is%20an%20array/namedParam[0]:test'; + $expected = '/tests/index/namedParam%5Bkeyed%5D:is%20an%20array/namedParam%5B0%5D:test'; $this->assertEquals($expected, $result); }