Permalink
Browse files

Router::reverse now removes models and paging keys that controllers c…

…an insert into params arrays.
  • Loading branch information...
1 parent 5b78a66 commit df8914b2e4151f88f7f2c046bbaa897cc4ed0cb6 @markstory markstory committed Dec 28, 2009
Showing with 4 additions and 2 deletions.
  1. +1 −1 cake/libs/router.php
  2. +3 −1 cake/tests/cases/libs/router.test.php
View
@@ -994,7 +994,7 @@ function reverse($params) {
$pass = $params['pass'];
$named = $params['named'];
$url = $params['url'];
- unset($params['pass'], $params['named'], $params['url'], $url['url']);
+ unset($params['pass'], $params['named'], $params['paging'], $params['models'], $params['url'], $url['url']);
$params = array_merge($params, $pass, $named);
if (!empty($url)) {
$params['?'] = $url;
@@ -1987,7 +1987,9 @@ function testRouterReverse() {
'action' => 'view',
'pass' => array(1),
'named' => array(),
- 'url' => array('url' => 'eng/posts/view/1', 'foo' => 'bar', 'baz' => 'quu')
+ 'url' => array('url' => 'eng/posts/view/1', 'foo' => 'bar', 'baz' => 'quu'),
+ 'paging' => array(),
+ 'models' => array()
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1?foo=bar&baz=quu');

0 comments on commit df8914b

Please sign in to comment.