From 577066e07e1a2eeec5746ad1cba9521451147727 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Thu, 7 Jul 2011 07:40:42 -0700 Subject: [PATCH] Tweak file cache driver to return null as default. --- system/cache/driver/file.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/system/cache/driver/file.php b/system/cache/driver/file.php index ce5128b7..e68bfb50 100644 --- a/system/cache/driver/file.php +++ b/system/cache/driver/file.php @@ -27,7 +27,7 @@ public function has($key) * @param mixed $default * @return mixed */ - public function get($key, $default = null) + public function get($key) { if (array_key_exists($key, $this->items)) { @@ -36,17 +36,14 @@ public function get($key, $default = null) if ( ! file_exists(APP_PATH.'storage/cache/'.$key)) { - return is_callable($default) ? call_user_func($default) : $default; + return null; } $cache = file_get_contents(APP_PATH.'storage/cache/'.$key); - // Has the cache expired? The UNIX expiration time is stored at the beginning of the file. if (time() >= substr($cache, 0, 10)) { - $this->forget($key); - - return is_callable($default) ? call_user_func($default) : $default; + return $this->forget($key); } return $this->items[$key] = unserialize(substr($cache, 10));