pajoye Tue, 25 Aug 2009 23:51:04 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=287719
Log: Improved readlink, supress \??\ and use the drive syntax only Changed paths: U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/standard/link_win32.c U php/php-src/trunk/ext/standard/link_win32.c Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2009-08-25 23:22:52 UTC (rev 287718) +++ php/php-src/branches/PHP_5_3/NEWS 2009-08-25 23:51:04 UTC (rev 287719) @@ -7,6 +7,9 @@ - Added error constant when json_encode() detects an invalid UTF-8 sequence. (Scott) + +- Improved readlink on Windows, supress \??\ and use the drive syntax only. + (Pierre) - Improved dns_get_record AAAA support on windows. Always available when IPv6 is support is installed, format is now the same than on unix. (Pierre) - Improved the DNS functions on OSX to use newer APIs, also use Bind 9 API @@ -14,7 +17,7 @@ - Improved shared extension loading on OSX to use the standard Unix dlopen() API. (Scott) -- Fixed possilbe bad caching of symlinked directories in the realpath cache +- Fixed possible bad caching of symlinked directories in the realpath cache on Windows. (Pierre) - Fixed atime and mtime in stat related functions on Windows. (Pierre) - Fixed spl_autoload_unregister/spl_autoload_functions wrt. Closures and Modified: php/php-src/branches/PHP_5_3/ext/standard/link_win32.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/link_win32.c 2009-08-25 23:22:52 UTC (rev 287718) +++ php/php-src/branches/PHP_5_3/ext/standard/link_win32.c 2009-08-25 23:51:04 UTC (rev 287719) @@ -107,7 +107,7 @@ RETURN_FALSE; } - dwRet = pGetFinalPathNameByHandle(hFile, Path, MAXPATHLEN, VOLUME_NAME_NT); + dwRet = pGetFinalPathNameByHandle(hFile, Path, MAXPATHLEN, VOLUME_NAME_DOS); if(dwRet >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't resolve the full path, the path exceeds the MAX_PATH_LEN (%d) limit", MAXPATHLEN); RETURN_FALSE; @@ -118,7 +118,14 @@ /* Append NULL to the end of the string */ Path[dwRet] = '\0'; - RETURN_STRING(Path, 1); + if(dwRet > 4) { + /* Skip first 4 characters if they are "\??\" */ + if(Path[0] == '\\' && Path[0] == '\\' && Path[1] == '?' && Path[2] == '?' && Path[3] == '\\') { + RETURN_STRING(Path + 4, 1); + } + } else { + RETURN_STRING(Path, 1); + } } /* }}} */ Modified: php/php-src/trunk/ext/standard/link_win32.c =================================================================== --- php/php-src/trunk/ext/standard/link_win32.c 2009-08-25 23:22:52 UTC (rev 287718) +++ php/php-src/trunk/ext/standard/link_win32.c 2009-08-25 23:51:04 UTC (rev 287719) @@ -106,7 +106,7 @@ RETURN_FALSE; } - dwRet = pGetFinalPathNameByHandle(hFile, Path, MAXPATHLEN, VOLUME_NAME_NT); + dwRet = pGetFinalPathNameByHandle(hFile, Path, MAXPATHLEN, VOLUME_NAME_DOS); if(dwRet >= MAXPATHLEN) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Can't resolve the full path, the path exceeds the MAX_PATH_LEN (%d) limit", MAXPATHLEN); RETURN_FALSE; @@ -117,7 +117,14 @@ /* Append NULL to the end of the string */ Path[dwRet] = '\0'; - RETURN_STRING(Path, 1); + if(dwRet > 4) { + /* Skip first 4 characters if they are "\??\" */ + if(Path[0] == '\\' && Path[0] == '\\' && Path[1] == '?' && Path[2] == '?' && Path[3] == '\\') { + RETURN_STRING(Path + 4, 1); + } + } else { + RETURN_STRING(Path, 1); + } } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php