php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17590 readdir fails on directory called "0"
Submitted: 2002-06-04 05:31 UTC Modified: 2002-06-04 05:41 UTC
From: mw at antitachyon dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.2.0 OS: SoL 13.37 (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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mw at antitachyon dot com
New email:
PHP Version: OS:

 

 [2002-06-04 05:31 UTC] mw at antitachyon dot com
If you have a directory which contains directories like "0" "1" "test" "mytestdir" and so on the function "readdir" returns only "." and ".." . If you remove the directory called "0" everything is fine again.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-04 05:35 UTC] mfischer@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

See php.net/opendir, you have to use the !== operator.
 [2002-06-04 05:41 UTC] derick@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

You have probably somethign like:

while ($a = readdir($dir)) {

in your code, this will not work as $a can be 0 sometimes (the name of the directory)

while (($a = readdir) !== FALSE) { // note the !==

Derick
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Mar 10 21:01:30 2025 UTC