From: d dot stogov at turck dot spb dot eu Operating system: Windows PHP version: 4.3.3 PHP Bug Type: Directory function related Bug description: Incorrect handling of absolute path without drive.
Description: ------------ This BUG is Windows releated. PHP thinks what filepathes started form one slash are relative. The problem comes from IS_ABSOLUTE_PATH definw which is defined in file "TSRM/tsrm_virtual_cwd.h" line 64. The original source is #define IS_ABSOLUTE_PATH(path, len) \ (len >= 2 && ((isalpha(path[0]) && path[1] == ':') || (IS_SLASH(path[0]) && IS_SLASH(path[1])))) but I think it must be changed to #define IS_ABSOLUTE_PATH(path, len) \ ((len >= 2 && isalpha(path[0]) && path[1] == ':') || \ (len >= 1 && IS_SLASH(path[0]) && IS_SLASH(path[1]))) I demonstrate the BUG of the glob() function, but it can occur in any place where IS_ABSOLUTE_PATH is used. Reproduce code: --------------- <?php function remove_drive($file) { return substr($file,2); } if (substr(PHP_OS,0,3) == WIN) { $drive = substr(getcwd(),0,2); $a1 = glob("/*"); $a2 = array_map("remove_drive",glob($drive."/*")); if ($a1==$a2) { echo "ok"; } else { echo "fail"; } } else { echo "ok"; } ?> Expected result: ---------------- ok Actual result: -------------- fail -- Edit bug report at http://bugs.php.net/?id=25583&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25583&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25583&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25583&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25583&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25583&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25583&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25583&r=support Expected behavior: http://bugs.php.net/fix.php?id=25583&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25583&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25583&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25583&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25583&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25583&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25583&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25583&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25583&r=float