PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File System » File_Find » Bug #2773

Directories with other directories named 0

Details

Submitted2004-11-16 21:44 UTC
Frompmurray at nevada dot net dot nz
Assignedtuupola
StatusClosed
PackageFile_Find
PHP Version4.3.9
OSLinux
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 '..'