php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30296 opendir does not like have a number as the first char
Submitted: 2004-10-01 01:08 UTC Modified: 2004-10-01 09:44 UTC
From: dravet at calumet dot purdue dot edu Assigned:
Status: Not a bug Package: Directory function related
PHP Version: 4.3.9 OS: Windows 2003 Enterprise
Private report: No CVE-ID: None
 [2004-10-01 01:08 UTC] dravet at calumet dot purdue dot edu
Description:
------------
Opendir does not appear to like having a number as the first char of a directory name.  If I rename 100LEVEL to LEVEL100 then the code works.

Reproduce code:
---------------
$current_dir "D:\htdocs\assessment\form40s\approved\100LEVEL";
$dir = opendir($current_dir);
while (false !== ($file=readdir($dir)))
{
print $file;
}
closedir($dir);


Expected result:
----------------
CIS100.pdfCIS103 (TECH 03-26) pdf.pdfCIS103.pdfCIS111(TECH 03-33) .pdfCIS111.pdfCIS140.pdfCIS166 FALL-2004.pdfCIS166(TECH 04-04).pdfCIS166- 2000.pdfCIS180(TECH 03-34).pdfCIS180.pdfCIS187.pdfFall 2003 Tech School Network.mdbFall 2003 Tech School.lnk 

This is the results when the directory is named LEVEL100.  I will format the text later.

Actual result:
--------------
PHP Warning: opendir(D:\htdocs\assessment\form40s\approved@LEVEL): failed to open dir: Invalid argument in D:\htdocs\assessment\form40s\approved\index.php on line 14 PHP Warning: readdir(): supplied argument is not a valid Directory resource in D:\htdocs\assessment\form40s\approved\index.php on line 15 PHP Warning: closedir(): supplied argument is not a valid Directory resource in D:\htdocs\assessment\form40s\approved\index.php on line 20 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-01 09:44 UTC] aidan@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It has nothing to do with opendir.

By using double quotes you instruct PHP to parse the string. \100 parses to @.

Use single quotes for strings.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC