Permalink
Browse files

Fixing issue where _restructureParams would move controller key to th…

…e plugin key causing issues switching controllers. Tests added. Fixes #115
  • Loading branch information...
1 parent 264cdb7 commit 1e7e65013397401740e6221ff187ceb0c851cc1a @markstory markstory committed Dec 17, 2009
Showing with 5 additions and 4 deletions.
  1. +3 −4 cake/dispatcher.php
  2. +2 −0 cake/tests/cases/dispatcher.test.php
View
@@ -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();
}
@@ -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);

0 comments on commit 1e7e650

Please sign in to comment.