From: Ilia Alshanetsky Date: Sat, 20 Sep 2003 02:52:45 +0000 (+0000) Subject: MFH: Fixed bug #25583 (Incorrect handling of paths starting with / on win32 X-Git-Tag: php-4.3.4RC1~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fea99094df362ba8987f96a5ab05aadbc6692a8b;p=php MFH: Fixed bug #25583 (Incorrect handling of paths starting with / on win32 inside glob() function). --- diff --git a/NEWS b/NEWS index 3ecb022e8c..7046492213 100644 --- a/NEWS +++ b/NEWS @@ -7,7 +7,8 @@ PHP 4 NEWS - Fixed crash bug when non-existing save/serializer handler was used. (Jani) - Fixed memory leak in gethostbynamel() if an error occurs. (Sara) - Fixed FastCGI being unable to bind to a specific IP. (Sascha) -- Fixed bug #25583 (Incorrect handling of absolute path without drive). (Ilia) +- Fixed bug #25583 (Incorrect handling of paths starting with / on win32 + inside glob() function). (Ilia) - Fixed bug #25570 (Possible crash in apache2handler when zend_bailout called outside of zend_try {} block). (Ilia) - Fixed bug #25530 (checkdate() incorrectly handles floats). (Ilia) diff --git a/ext/standard/dir.c b/ext/standard/dir.c index 13d4ecc291..bfec94618e 100644 --- a/ext/standard/dir.c +++ b/ext/standard/dir.c @@ -371,6 +371,11 @@ PHP_FUNCTION(glob) cwd[0] = '\0'; } cwd_skip = strlen(cwd)+1; +#ifdef PHP_WIN32 + if (IS_SLASH(cwd[0]) && !IS_UNC_PATH(pattern, pattern_len)) { + cwd[2] = '\0'; + } +#endif snprintf(work_pattern, MAXPATHLEN, "%s%c%s", cwd, DEFAULT_SLASH, pattern); pattern = work_pattern; }