Skip to content
This repository
Browse code

save some memory usage (PHP < 5.4) in case of huge content and cut of…

…f the isset call
  • Loading branch information...
commit 6d3e0a25b29eb16f5cbeac30481cc1dc2410008f 1 parent 2170d87
Mark authored September 15, 2012
3  lib/Cake/Controller/Component/CookieComponent.php
@@ -291,8 +291,7 @@ public function check($key = null) {
291 291
 		if (empty($key)) {
292 292
 			return false;
293 293
 		}
294  
-		$result = $this->read($key);
295  
-		return isset($result);
  294
+		return $this->read($key) !== null;
296 295
 	}
297 296
 
298 297
 /**
3  lib/Cake/Core/Configure.php
@@ -180,8 +180,7 @@ public static function check($var = null) {
180 180
 		if (empty($var)) {
181 181
 			return false;
182 182
 		}
183  
-		$result = Hash::get(self::$_values, $var);
184  
-		return isset($result);
  183
+		return Hash::get(self::$_values, $var) !== null;
185 184
 	}
186 185
 
187 186
 /**
6  lib/Cake/Model/Datasource/CakeSession.php
@@ -218,8 +218,7 @@ public static function check($name = null) {
218 218
 		if (empty($name)) {
219 219
 			return false;
220 220
 		}
221  
-		$result = Hash::get($_SESSION, $name);
222  
-		return isset($result);
  221
+		return Hash::get($_SESSION, $name) !== null;
223 222
 	}
224 223
 
225 224
 /**
@@ -283,9 +282,8 @@ protected static function _overwrite(&$old, $new) {
283 282
 	protected static function _error($errorNumber) {
284 283
 		if (!is_array(self::$error) || !array_key_exists($errorNumber, self::$error)) {
285 284
 			return false;
286  
-		} else {
287  
-			return self::$error[$errorNumber];
288 285
 		}
  286
+		return self::$error[$errorNumber];
289 287
 	}
290 288
 
291 289
 /**

0 notes on commit 6d3e0a2

Please sign in to comment.
Something went wrong with that request. Please try again.