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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC