From: trustpunk at hotmail dot com
Operating system: Windows XP
PHP version: 5.0.5
PHP Bug Type: Directory function related
Bug description: glob/opendir (path limit)
Description:
------------
When you use a path thats greater than 246 char(s) and the file within
that path is greater than 22 char(s). A Warning Will be shown using the
following code below. This is a bug!
Now I know its a bit overkill to have a path so big but when your creating
a directory listing script , you want to be able to list all files no
matter how big the path to the files are.
Note: Im not using Symbolic Links. Im only using a relative
path within the current directory the script is in.
Reproduce code:
---------------
Using the opendir() method to list files.
<?php
$dir = opendir("dir... here");
while($file = readdir($dir)) {
$file_name = "$dir/" . $file;
if (is_file($file_name)) {
echo $file_name . " Size: " .
filesize($file_name) . "<br>";
}
}
closedir($dir);
?>
Using the glob() method to list files.
<?php
$dir = "dir... here";
foreach(glob("$dir/*.mp3") as $file_name) {
echo $file_name . " Size: " .
filesize($file_name) . "<br>";
}
?>
Using glob(); function to list files will just report
a Warning that the foreach loop failed and what not.
Expected result:
----------------
I expect all files to be listed without Warnings!
Actual result:
--------------
I get a bunch of Warnings when using the opendir() method and a Warning
when I use the glob() function to list the files.
--
Edit bug report at http://bugs.php.net/?id=34983&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34983&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34983&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34983&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34983&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34983&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34983&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34983&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34983&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34983&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34983&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34983&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34983&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34983&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34983&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34983&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34983&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34983&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34983&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34983&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34983&r=mysqlcfg