ID: 34983 User updated by: trustpunk at hotmail dot com Reported By: trustpunk at hotmail dot com -Status: Closed +Status: Open Bug Type: Directory function related Operating System: Windows XP PHP Version: 5.0.5 New Comment:
Im sorry to say but PHP - v5.0.6 Dev did not fix it. Here's the path I was using , you can see if from the PHP error. Warning: filesize() [function.filesize]: stat failed for 6c7695d7af/ohn/example/Silverstein/music/10 - Three Hours Back/02 - Smile In Your Sleep/01 - Your Sword Versus My Dagger/05 - Discovering The Waterfront/08 - Always And Never/I like you the way you are/01 - Your Sword Versus My Dagger.mp3 in C:\Website\directory_listing.php on line 82 Previous Comments: ------------------------------------------------------------------------ [2005-10-26 03:55:19] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed already according to user. ------------------------------------------------------------------------ [2005-10-26 00:38:22] trustpunk at hotmail dot com The opendir had a small bug in it. Its Fixed! <pre> <?php $dir = "dir... here"; $open = opendir($dir); while($file = readdir($open)) { $file_name = "$dir/" . $file; if (is_file($file_name)) { echo $file . " Size: " . filesize($file_name) . "<br>"; } } closedir($open); ?> </pre> ------------------------------------------------------------------------ [2005-10-26 00:17:45] trustpunk at hotmail dot com 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 this bug report at http://bugs.php.net/?id=34983&edit=1
