diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 6730499389b..abfd56d5da1 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -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(); } diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index ddd2c306206..47aa91d3fc7 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -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);