php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10856 is_dir() does only recognize . and .. as directory, nothing else
Submitted: 2001-05-14 14:04 UTC Modified: 2001-05-14 14:32 UTC
From: marc at links2linux dot de Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.0.4pl1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marc at links2linux dot de
New email:
PHP Version: OS:

 

 [2001-05-14 14:04 UTC] marc at links2linux dot de
 $d = dir("/");
 echo "Handle: ".$d->handle."<br>\n";
 echo "Path: ".$d->path."<br>\n";
 while($entry=$d->read()) {
     if (is_dir($entry)) echo "[DIR]";
     echo $entry."<br>\n";
     }
    $d->close();
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-14 14:18 UTC] derick@php.net
Hello,

this is a little error in your logic,
$d->read() returns a string, and the is_dir() only checks in the _current_ directory for that string.
Aparrantly you don't have (p.e.) bin in your current dir, so is_dir() failed on it.
I'm checking if I can make this a warning, but I'm closing this report now, because it's not a bug.

Derick
 [2001-05-14 14:32 UTC] derick@php.net
Ok, I bumbed up the error level from E_NOTICE to E_WARNING.

Derick
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 08:01:24 2020 UTC