|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32916 dir::read() method doesn't return expected result
Submitted: 2005-05-02 21:37 UTC Modified: 2005-05-02 23:07 UTC
From: laidbak6921 at yahoo dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.3.10 OS: FreeBSD 4.7
Private report: No CVE-ID: None
 [2005-05-02 21:37 UTC] laidbak6921 at yahoo dot com
The dir class method read works if using it just the way it is stated in the documentation, however, if I re-write it to use TRUE=== it fails. See code example:

Reproduce code:
Original Code Snippet:

$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
   echo $entry."\n";

while (false !== ($entry = $d->read())) {

while (true === ($entry = $d->read())) {

Expected result:
Expected the alternative version to return true, but it did not.

Actual result:
Code returned false.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-02 23:07 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

dir::read() returns a string with a filename, no bool. 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 23:01:27 2024 UTC