php.net |  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
Description:
------------
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:

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


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

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

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

Actual result:
--------------
Code returned false.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

dir::read() returns a string with a filename, no bool. 
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 11:01:23 2020 UTC