php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3326 readdir doesn't give ALL names of a directory (some names are missing!!)
Submitted: 2000-01-26 23:18 UTC Modified: 2000-03-18 09:10 UTC
From: php3_bug_report at pepsi dot itgo dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0.12 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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php3_bug_report at pepsi dot itgo dot com
New email:
PHP Version: OS:

 

 [2000-01-26 23:18 UTC] php3_bug_report at pepsi dot itgo dot com
your example script:

<?php
                        $handle=opendir('.');
                        echo "Directory handle: $handle\n";
                        echo "Files:\n";
                        while ($file = readdir($handle)) {
                            echo "$file\n";
                        }
                        closedir($handle); 
?>

the directory listing:
drwxr-xr-x   4 userr  users        1024 Jan 27 04:57 ./
drwxr-xr-x   3 userr  users        1024 Jan 17 12:04 ../
drwxr-xr-x   2 userr  users        1024 Jan 27 04:55 Bilder/
-rw-r--r--   1 userr  users       29184 Jun 24  1999 call-by-call.xls
-rw-r--r--   1 userr  users         185 Dec 15 20:29 index.alt
drwxrwxrwx   2 userr  users        1024 Jan 27 04:55 uploads/

what I get:
.
..
uploads
call-by-call.xls


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-02-06 06:28 UTC] sas at cvs dot php dot net
Change

while ($file = readdir($handle)) {

to

while (($file = readdir($handle)) != "") {
 [2000-02-06 13:51 UTC] php3_bug_report at pepsi dot itgo dot com
I have already tried this version 
I tried '!=false' and '!=""' - same result - 
the only difference is the problem with the file "0" 
mentioned in some other bug-reports (for example id=1236)
 [2000-03-18 09:10 UTC] php3_bug_report at pepsi dot itgo dot com
I found the error in MY source - sorry
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 02:00:01 2026 UTC