ID: 31347 Comment by: nunbot at gmail dot com Reported By: gilad dot buzi at concatel dot com Status: Verified Bug Type: Filesystem function related Operating System: win32 only PHP Version: 5CVS, 4CVS (2005-03-06) New Comment:
I've seen this in 5.0.4 build 2600 using win32. Unfortunately the string length does not seem to matter at all on both is_dir() and is_file(). ~nunbot Previous Comments: ------------------------------------------------------------------------ [2005-02-22 15:52:52] [EMAIL PROTECTED] Win32 specific bug, due to the stat() function not having handling in place for filenames >255 chars. ------------------------------------------------------------------------ [2005-02-20 16:21:11] smith at backendmedia dot com You can add file_exists() to the list of functions that have this error. I tested this with php4-win32-STABLE-200502081330.zip ------------------------------------------------------------------------ [2004-12-30 10:43:57] gilad dot buzi at concatel dot com Description: ------------ is_dir() and is_file() (incorrectly) return true for any string larger than 255 characters. I tried this on two different machines, with the out of the box, precompiled/downloaded Windows version of php 5.0.3. No changes were made to the standard php.ini-dist. No extra extensions were loaded. We are using PHP as an Apache2 module (php2apache2.dll). We also tried the latest CVS snapshot (5CVS-2004-12-30 (dev)) and got the same results. We tried, and could NOT reproduce this on Linux. It only failed on windows platforms. Curiously (or maybe not so curious), file_exists() DOES work fine. Reproduce code: --------------- <? $myfilename="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccsssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccssssssssssssssssssssssssssssssssssssssssssssss"; echo "myfilename is: $myfilename"; echo "<br>myfilename is ".strlen($myfilename)." characters long"; echo "<br>is_dir: ".is_dir($myfilename); echo "<br>file_exists: ".file_exists($myfilename); echo "<br>is_file: ".is_file($myfilename); $myfilename="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccsssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccssssssssssssssssssssssssssssssssssssssssssssss"; echo "<br><br>myfilename is: $myfilename"; echo "<br>myfilename is ".strlen($myfilename)." characters long"; echo "<br>is_dir: ".is_dir($myfilename); echo "<br>file_exists: ".file_exists($myfilename); echo "<br>is_file: ".is_file($myfilename); ?> Expected result: ---------------- is_dir() and is_file() should return false if the file or directory does not exist, regardless of the length of the string they are passed. Actual result: -------------- Result for above script is: myfilename is: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccsssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccssssssssssssssssssssssssssssssssssssssssssssss myfilename is 255 characters long is_dir: file_exists: is_file: myfilename is: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccsssssssssssssssssssssssssssssssssssssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaccccccccccccccccccccccccccssssssssssssssssssssssssssssssssssssssssssssss myfilename is 256 characters long is_dir: 1 file_exists: 1 is_file: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31347&edit=1