Merge branch 'PHP-7.4'

* PHP-7.4:
  Revert "Fix #79806: realpath() erroneously resolves link to link"
This commit is contained in:
Christoph M. Becker 2020-07-27 17:53:23 +02:00
commit 592f70bc46
2 changed files with 8 additions and 12 deletions

View file

@ -590,7 +590,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
} }
#ifdef ZEND_WIN32 #ifdef ZEND_WIN32
retry_reparse_point:
if (save) { if (save) {
pathw = php_win32_ioutil_any_to_w(path); pathw = php_win32_ioutil_any_to_w(path);
if (!pathw) { if (!pathw) {
@ -613,7 +612,7 @@ retry_reparse_point:
tmp = do_alloca(len+1, use_heap); tmp = do_alloca(len+1, use_heap);
memcpy(tmp, path, len+1); memcpy(tmp, path, len+1);
retry_reparse_tag_cloud: retry:
if(save && if(save &&
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') && !(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) (dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@ -674,7 +673,7 @@ retry_reparse_tag_cloud:
dataw.dwFileAttributes = fileInformation.dwFileAttributes; dataw.dwFileAttributes = fileInformation.dwFileAttributes;
CloseHandle(hLink); CloseHandle(hLink);
(*ll)--; (*ll)--;
goto retry_reparse_tag_cloud; goto retry;
} }
free_alloca(tmp, use_heap); free_alloca(tmp, use_heap);
CloseHandle(hLink); CloseHandle(hLink);
@ -821,15 +820,6 @@ retry_reparse_tag_cloud:
free_alloca(pbuffer, use_heap_large); free_alloca(pbuffer, use_heap_large);
free(substitutename); free(substitutename);
{
DWORD attrs = GetFileAttributesA(path);
if (!isVolume && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
free_alloca(tmp, use_heap);
FREE_PATHW()
goto retry_reparse_point;
}
}
if(isabsolute == 1) { if(isabsolute == 1) {
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) { if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
/* use_realpath is 0 in the call below coz path is absolute*/ /* use_realpath is 0 in the call below coz path is absolute*/

View file

@ -1,5 +1,11 @@
--TEST-- --TEST--
Test realpath() with relative paths Test realpath() with relative paths
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip no symlinks on Windows');
}
?>
--FILE-- --FILE--
<?php <?php
$file_path = __DIR__; $file_path = __DIR__;