Bug #18679 [Opn->Ver]: _cleanDir missing files

From: Date: Fri, 22 Jul 2011 10:21:47 +0000
Subject: Bug #18679 [Opn->Ver]: _cleanDir missing files
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to [email protected] to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=18679&edit=1

 ID:               18679
 Updated by:       [email protected]
 Reported By:      tama at springload dot co dot nz
 Summary:          _cleanDir missing files
-Status:           Open
+Status:           Verified
 Type:             Bug
 Package:          Cache_Lite
-Operating System: Debian
+Operating System: Irrelevant
 Package Version:  1.7.11
 PHP Version:      Irrelevant
-Assigned To:      
+Assigned To:      tacker
 Roadmap Versions: 
 New Comment:

-Status:           Open
+Status:           Verified
-Operating System: Debian
+Operating System: Irrelevant
-Assigned To:
+Assigned To:      tacker



Previous Comments:
------------------------------------------------------------------------

[2011-07-22 00:11:47] tama

Description:
------------
If the cache folder contains a directory or filename that evaluates to
false in PHP (e.g. 0) the _cleanDir method will skip files.


Test script:
---------------
It's an easy fix:

Index: Lite.php
===================================================================
--- Lite.php	(revision xxx)
+++ Lite.php	(working copy)
@@ -624,7 +624,7 @@
             return $this->raiseError('Cache_Lite : Unable to open cache
directory !', -4);
         }
         $result = true;
-        while ($file = readdir($dh)) {
+        while(($file = readdir($dh)) !== false) {
             if (($file != '.') && ($file != '..')) {
                 if (substr($file, 0, 6)=='cache_') {
                     $file2 = $dir . $file;

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=18679&edit=1



Thread (1 message)

« previous php.pear.bugs (#6586) next »