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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Mon Aug 10 02:01:24 2020 UTC