PHP 4.0 Bug #5535: String_comparison in readdir-loop fails
| From: | s dot kirch at bauer-kirch dot de | Date: | Wed, 12 Jul 2000 18:48:57 +0000 |
| Subject: | PHP 4.0 Bug #5535: String_comparison in readdir-loop fails | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-24216@lists.php.net to get a copy of this message | ||
From: s.kirch@bauer-kirch.de
Operating system: Linux
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: String_comparison in readdir-loop fails
There seems to be still a Bug in combination with the readdir-statement. In Bug 5296 there is
written something about a bug in the readdir-loop:
<?php
$handle=opendir('.');
while ($file = readdir($handle)) {
if ($file != "." && $file != "..") {
echo "$file\n";
}
}
closedir($handle);
?>
We have 4.0.1pl2, so there is no warning like described in 5296, BUT:
If we write this string-comparison, the loop seems to break and so there is no file printed out. If
we replace the
string-comparison with a regex, e.g.
if (!(ereg("^\.\.?$", $files))) {
everything works fine.
Also a "stupid" string-comparison
if ($x != "dummy") {
leads to the same "loop-break-problem"
Any idea?!?
Steff