[chora] problem when 0 is the name of a directory
Chuck Hagenbuch
chuck@horde.org
Tue, 6 Mar 2001 23:14:16 -0500
Quoting Jon Parise <jon@csh.rit.edu>:
> > while (($name = readdir($DIR)) != '') {
>
> I usually prefer to use empty() for cases like this, but I don't know
> which method is better (in terms of performance or readability).
In this case, I think the preferred way to write it would be:
while (($name = readdir($DIR)) !== false)
empty would still return true on 0 as the directory name, and there's no way to
apply empty() directly within the while loop above without adding an extra step.
I'll commit this in a moment - I just reproduced the revs problem, or something
suspiciously similar, so I'm trying to track it down.
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"Live, from Washington, where the doctors were telling us what they did, and
did not, do with Vice President Cheney." -Dan Rather