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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 07:01:28 2024 UTC