Skip to content

Commit 592f70b

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Revert "Fix #79806: realpath() erroneously resolves link to link"
2 parents b231889 + f025074 commit 592f70b

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Zend/zend_virtual_cwd.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
590590
}
591591

592592
#ifdef ZEND_WIN32
593-
retry_reparse_point:
594593
if (save) {
595594
pathw = php_win32_ioutil_any_to_w(path);
596595
if (!pathw) {
@@ -613,7 +612,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
613612
tmp = do_alloca(len+1, use_heap);
614613
memcpy(tmp, path, len+1);
615614

616-
retry_reparse_tag_cloud:
615+
retry:
617616
if(save &&
618617
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
619618
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -674,7 +673,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
674673
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
675674
CloseHandle(hLink);
676675
(*ll)--;
677-
goto retry_reparse_tag_cloud;
676+
goto retry;
678677
}
679678
free_alloca(tmp, use_heap);
680679
CloseHandle(hLink);
@@ -821,15 +820,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
821820
free_alloca(pbuffer, use_heap_large);
822821
free(substitutename);
823822

824-
{
825-
DWORD attrs = GetFileAttributesA(path);
826-
if (!isVolume && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
827-
free_alloca(tmp, use_heap);
828-
FREE_PATHW()
829-
goto retry_reparse_point;
830-
}
831-
}
832-
833823
if(isabsolute == 1) {
834824
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
835825
/* use_realpath is 0 in the call below coz path is absolute*/

ext/standard/tests/file/realpath_basic4.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
--TEST--
22
Test realpath() with relative paths
3+
--SKIPIF--
4+
<?php
5+
if (substr(PHP_OS, 0, 3) == 'WIN') {
6+
die('skip no symlinks on Windows');
7+
}
8+
?>
39
--FILE--
410
<?php
511
$file_path = __DIR__;

0 commit comments

Comments
 (0)