diff --git a/cake/dispatcher.php b/cake/dispatcher.php index 17365c825..1b56a8605 100644 --- a/cake/dispatcher.php +++ b/cake/dispatcher.php @@ -172,7 +172,7 @@ class Dispatcher extends Object { $missingAction = true; } - if (in_array('return', array_keys($this->params)) && $this->params['return'] == 1) { + if (array_key_exists('return', $this->params) && $this->params['return'] == 1) { $controller->autoRender = false; } $controller->base = $this->base; @@ -241,10 +241,10 @@ class Dispatcher extends Object { */ function _invoke(&$controller, $params, $missingAction = false) { $classVars = get_object_vars($controller); - if ($missingAction && in_array('scaffold', array_keys($classVars))) { + if ($missingAction && array_key_exists('scaffold', $classVars)) { App::import('Core', 'Scaffold'); return new Scaffold($controller, $params); - } elseif ($missingAction && !in_array('scaffold', array_keys($classVars))) { + } elseif ($missingAction && !array_key_exists('scaffold', $classVars)) { return $this->cakeError('missingAction', array( array( 'className' => Inflector::camelize($params['controller']."Controller"), diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 1d0f6d4c2..4c27edb80 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -704,7 +704,7 @@ class View extends Object { } $helperCn = $helper . 'Helper'; - if (in_array($helper, array_keys($loaded)) !== true) { + if (array_key_exists($helper, $loaded) !== true) { if (!class_exists($helperCn)) { if (is_null($plugin) || !App::import('Helper', $plugin . '.' . $helper)) { if (!App::import('Helper', $helper)) { diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index bac6fee97..2c2beb7f5 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -47,10 +47,10 @@ class TestDispatcher extends Dispatcher { function _invoke(&$controller, $params, $missingAction) { $controller->params =& $params; $classVars = get_object_vars($controller); - if ($missingAction && in_array('scaffold', array_keys($classVars))) { + if ($missingAction && array_key_exists('scaffold', $classVars)) { uses('controller'. DS . 'scaffold'); return new Scaffold($controller, $params); - } elseif ($missingAction && !in_array('scaffold', array_keys($classVars))) { + } elseif ($missingAction && !array_key_exists('scaffold', $classVars)) { return $this->cakeError('missingAction', array( array( 'className' => Inflector::camelize($params['controller']."Controller"),