Home » File System » File_Find » Bug #2773
Directories with other directories named 0
Details
| 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) |
Comments
[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 '..'