Skip to content

Commit

Permalink
save some memory usage (PHP < 5.4) in case of huge content and cut of…
Browse files Browse the repository at this point in the history
…f the isset call
  • Loading branch information
euromark committed Sep 15, 2012
1 parent 2170d87 commit 6d3e0a2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions lib/Cake/Controller/Component/CookieComponent.php
Expand Up @@ -291,8 +291,7 @@ public function check($key = null) {
if (empty($key)) {
return false;
}
$result = $this->read($key);
return isset($result);
return $this->read($key) !== null;
}

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/Cake/Core/Configure.php
Expand Up @@ -180,8 +180,7 @@ public static function check($var = null) {
if (empty($var)) {
return false;
}
$result = Hash::get(self::$_values, $var);
return isset($result);
return Hash::get(self::$_values, $var) !== null;
}

/**
Expand Down
6 changes: 2 additions & 4 deletions lib/Cake/Model/Datasource/CakeSession.php
Expand Up @@ -218,8 +218,7 @@ public static function check($name = null) {
if (empty($name)) {
return false;
}
$result = Hash::get($_SESSION, $name);
return isset($result);
return Hash::get($_SESSION, $name) !== null;
}

/**
Expand Down Expand Up @@ -283,9 +282,8 @@ protected static function _overwrite(&$old, $new) {
protected static function _error($errorNumber) {
if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
return false;
} else {
return self::$error[$errorNumber];
}
return self::$error[$errorNumber];
}

/**
Expand Down

0 comments on commit 6d3e0a2

Please sign in to comment.