Replaced in_array() with array_key_exists(). Closes #4465

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7336 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-07-12 00:23:08 +00:00
parent 20851bd548
commit 684fb5fcce
3 changed files with 6 additions and 6 deletions

View file

@ -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"),

View file

@ -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)) {

View file

@ -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"),