diff --git a/cake/libs/router.php b/cake/libs/router.php index 16af52f67..53355b640 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -1084,11 +1084,14 @@ class Router { */ public static function reverse($params) { if ($params instanceof CakeRequest) { + $url = $params->query; $params = $params->params; + } else { + $url = $params['url']; } $pass = $params['pass']; $named = $params['named']; - $url = $params['url']; + unset( $params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url'], $params['autoRender'], $params['bare'], $params['requested'], $params['return'] diff --git a/cake/tests/cases/libs/router.test.php b/cake/tests/cases/libs/router.test.php index 930674093..5b7d88543 100644 --- a/cake/tests/cases/libs/router.test.php +++ b/cake/tests/cases/libs/router.test.php @@ -2309,9 +2309,11 @@ class RouterTest extends CakeTestCase { 'action' => 'view', 'pass' => array(1), 'named' => array(), - 'url' => array('url' => 'eng/posts/view/1') )); + $request->query = array('url' => 'eng/posts/view/1', 'test' => 'value'); $result = Router::reverse($request); + $expected = '/eng/posts/view/1?test=value'; + $this->assertEquals($expected, $result); } /**