[PEAR-BUG] Bug #18679 [Ver->Csd]: _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:           Verified
+Status:           Closed
 Type:             Bug
 Package:          Cache_Lite
 Operating System: Irrelevant
 Package Version:  1.7.11
 PHP Version:      Irrelevant
 Assigned To:      tacker
 Roadmap Versions: 
 New Comment:

-Status: Verified
+Status: Closed
Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/




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

[2011-07-22 11:21:46] tacker

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


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

[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.