Don't hide errors when accessing the GC file, and don't try to do
authorJan Schneider <jan@horde.org>
Mon, 20 Sep 2010 10:17:56 +0000 (12:17 +0200)
committerJan Schneider <jan@horde.org>
Mon, 20 Sep 2010 10:59:57 +0000 (12:59 +0200)
further operations on it if we failed opening it.

framework/Cache/lib/Horde/Cache/File.php

index e59e1dc..cc36998 100644 (file)
@@ -156,9 +156,11 @@ class Horde_Cache_File extends Horde_Cache_Base
             // This may result in duplicate entries in horde_cache_gc, but we
             // will take care of these whenever we do GC and this is quicker
             // than having to check every time we access the file.
-            $fp = fopen($this->_dir . '/horde_cache_gc', 'a');
-            fwrite($fp, $filename . "\t" . (empty($lifetime) ? 0 : time() + $lifetime) . "\n");
-            fclose($fp);
+            $fp = @fopen($this->_dir . '/horde_cache_gc', 'a');
+            if ($fp) {
+                fwrite($fp, $filename . "\t" . (empty($lifetime) ? 0 : time() + $lifetime) . "\n");
+                fclose($fp);
+            }
         }
     }