Skip to content

Commit

Permalink
Fixing issue where _restructureParams would move controller key to th…
Browse files Browse the repository at this point in the history
…e plugin key causing issues switching controllers. Tests added. Fixes #115
  • Loading branch information
markstory committed Dec 17, 2009
1 parent 264cdb7 commit 1e7e650
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions cake/dispatcher.php
Expand Up @@ -420,14 +420,13 @@ function &__getController() {
$this->params = $original;
return $controller;
}
} else {
if (!isset($params['plugin'])) {
$params = $this->_restructureParams($params);
}
}
$name = $ctrlClass;
$ctrlClass .= 'Controller';
if (class_exists($ctrlClass)) {
if (empty($params['plugin']) && strtolower(get_parent_class($ctrlClass)) === strtolower($name . 'AppController')) {
$params = $this->_restructureParams($params);
}
$this->params = $params;
$controller =& new $ctrlClass();
}
Expand Down
2 changes: 2 additions & 0 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -1321,6 +1321,8 @@ function testDispatch() {

$url = 'pages/home/';
$controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertNull($controller->plugin);
$this->assertNull($Dispatcher->params['plugin']);

$expected = 'Pages';
$this->assertEqual($expected, $controller->name);
Expand Down

0 comments on commit 1e7e650

Please sign in to comment.