Permalink
Browse files

Merge pull request #57 from tedivm/data_bug

Reworking of Filesystem handler
  • Loading branch information...
2 parents d295e16 + 12689cd commit 677de25b543e19684b7f1fac37510fc52e47d281 @tedivm tedivm committed Feb 26, 2013
Showing with 22 additions and 1 deletion.
  1. +22 −1 src/Stash/Driver/FileSystem.php
@@ -140,7 +140,28 @@ static protected function getDataFromFile($path)
}
include($path);
- return !isset($data) && !@is_null($data) ? false : array('data' => $data, 'expiration' => $expiration);
+
+ // If the item does not exist we should return false. However, it's
+ // possible that the item exists as null, so we have to make sure that
+ // it's both unset and not null. The downside to this is that the
+ // is_null function will issue a warning on an item that isn't set.
+ // So we're stuck testing and surpressing the warning.
+
+ // Item exists
+ // isset + is_null = true + false = true
+ if(isset($data))
+ {
+ return array('data' => $data, 'expiration' => $expiration);
+
+ // Item is null
+ // isset + is_null = false + true = true
+ }elseif(@is_null($data)){
+ return array('data' => null, 'expiration' => $expiration);
+ }
+
+ // Item does not exist
+ // isset + is_null = false + notice/false = false
+ return false;
}

0 comments on commit 677de25

Please sign in to comment.