diff --git a/cake/libs/router.php b/cake/libs/router.php index 0865c3703e2..b9cc681303d 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -1045,6 +1045,9 @@ function queryString($q, $extra = array(), $escape = false) { * Since parsed URL's contain additional 'pass' and 'named' as well as 'url.url' keys. * Those keys need to be specially handled in order to reverse a params array into a string url. * + * This will strip out 'autoRender', 'bare', 'requested', and 'return' param names as those + * are used for CakePHP internals and should not normally be part of an output url. + * * @param array $param The params array that needs to be reversed. * @return string The string that is the reversed result of the array * @access public @@ -1054,7 +1057,10 @@ function reverse($params) { $pass = $params['pass']; $named = $params['named']; $url = $params['url']; - unset($params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url']); + unset( + $params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url'], + $params['autoRender'], $params['bare'], $params['requested'], $params['return'] + ); $params = array_merge($params, $pass, $named); if (!empty($url)) { $params['?'] = $url; diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index ff995499d07..f44c32bdc9b 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -2059,7 +2059,11 @@ function testRouterReverse() { 'action' => 'view', 'pass' => array(1), 'named' => array(), - 'url' => array() + 'url' => array(), + 'autoRender' => 1, + 'bare' => 1, + 'return' => 1, + 'requested' => 1 ); $result = Router::reverse($params); $this->assertEqual($result, '/posts/view/1');