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

[email protected]
Newsgroups php.pear.bugs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.