php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8822 readdir doesn't return directories starting with a digit
Submitted: 2001-01-20 16:03 UTC Modified: 2001-01-20 16:28 UTC
From: vahan at design dot am Assigned:
Status: Closed Package: Directory function related
PHP Version: 4.0 Latest CVS (20/01/2001) OS: FreeBSD
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: vahan at design dot am
New email:
PHP Version: OS:

 

 [2001-01-20 16:03 UTC] vahan at design dot am
function dir_list($dirname) 
{ 
 if($dirname[strlen($dirname)-1]!='/') 
 $dirname.='/'; 
 $handle=opendir($dirname); 
 while ($file = readdir($handle)) 
  { 
   if($file=='.'||$file=='..') continue;
   $result_array[]=$dirname.$file; 
   } 
 closedir($handle); 
 return $result_array; 
};

executed for a directory which has subdirectory that has a digit/special character as a first character of it's name,
then that subdirectory won't be included in the $result_array

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-20 16:28 UTC] rasmus@php.net
Your script is wrong.  Use:

while (($file = readdir($handle))!==false)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 08:01:29 2025 UTC