save some memory usage (PHP < 5.4) in case of huge content and cut off the isset call

This commit is contained in:
euromark 2012-09-15 02:33:05 +02:00
parent 2170d87488
commit 6d3e0a25b2
3 changed files with 4 additions and 8 deletions

View file

@ -291,8 +291,7 @@ class CookieComponent extends Component {
if (empty($key)) { if (empty($key)) {
return false; return false;
} }
$result = $this->read($key); return $this->read($key) !== null;
return isset($result);
} }
/** /**

View file

@ -180,8 +180,7 @@ class Configure {
if (empty($var)) { if (empty($var)) {
return false; return false;
} }
$result = Hash::get(self::$_values, $var); return Hash::get(self::$_values, $var) !== null;
return isset($result);
} }
/** /**

View file

@ -218,8 +218,7 @@ class CakeSession {
if (empty($name)) { if (empty($name)) {
return false; return false;
} }
$result = Hash::get($_SESSION, $name); return Hash::get($_SESSION, $name) !== null;
return isset($result);
} }
/** /**
@ -283,9 +282,8 @@ class CakeSession {
protected static function _error($errorNumber) { protected static function _error($errorNumber) {
if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) { if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
return false; return false;
} else {
return self::$error[$errorNumber];
} }
return self::$error[$errorNumber];
} }
/** /**