File_Find patch
| From: | Chandrashekhar Bhosle | Date: | Sat, 28 Dec 2002 09:41:42 +0000 |
| Subject: | File_Find patch | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-11869@lists.php.net to get a copy of this message | ||
Hi,
Tiny patch to compare readdir() return value using !==
in File_Find. Only checking if ($file = readdir($dir))
doesn't seem to work for some dir paths (specifically /var/qmail/queue/remote of qmail
installations)
- cnb
--- Find.orig.php 2002-12-28 14:06:40.000000000 +0530
+++ Find.php 2002-12-28 14:03:09.000000000 +0530
@@ -78,7 +78,7 @@
$match_function = File_Find::_determineRegex($pattern, $pattern_type);
$matches = array();
- while ($entry = @readdir ($dh)) {
+ while (false !== ($entry = @readdir ($dh)) {
if ($match_function($pattern, $entry) &&
$entry != '.' &&
$entry != '..') {
@@ -150,7 +150,7 @@
$directory .= DIRECTORY_SEPARATOR;
$dh=opendir($directory);
- while ($entry = readdir($dh)) {
+ while (false !== ($entry = readdir($dh)) {
if ($entry != "." && $entry != "..") {
array_push($retval, $entry);
}
@@ -246,7 +246,7 @@
return $pe;
}
- while ($entry = @readdir($dh)) {
+ while (false !== ($entry = @readdir($dh)) {
if ($entry != '.' &&
$entry != '..') {