Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.3

Bug #2773 Directories with other directories named 0
Submitted: 2004-11-16 21:44 UTC
From: pmurray at nevada dot net dot nz Assigned: tuupola
Status: Closed Package: File_Find
PHP Version: 4.3.9 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-16 21:44 UTC] pmurray at nevada dot net dot nz
Description: ------------ If a directory that File::Find recurses into has a file or directory named 0, the test thinks it's finished and incorrectly terminates. Strangely, this didn't occur on FreeBSD, only Linux (both with PHP 4.3.9) The following patch fixes it: --- Find.php.orig Wed Nov 17 10:37:35 2004 +++ Find.php Wed Nov 17 10:40:10 2004 @@ -150,7 +150,7 @@ $directory .= DIRECTORY_SEPARATOR; $dh=opendir($directory); - while ($entry = readdir($dh)) { + while (($entry = readdir($dh)) !== false) { if ($entry != "." && $entry != "..") { array_push($retval, $entry); } Reproduce code: --------------- <? include("File/Find.php"); $filefind = new File_Find(); print_r($filefind->mapTreemultiple("./test", 50)); ?> Expected result: ---------------- Print out the contents of the directory Actual result: -------------- Stops at '..'

Comments

 [2004-12-13 11:25 UTC] tuupola
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better. Will roll a new release soon.