Skip to content

Commit 1aeff52

Browse files
committed
Revert "Fix #79806: realpath() erroneously resolves link to link"
This reverts commit d5b59b4.
1 parent d5b59b4 commit 1aeff52

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

NEWS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ PHP NEWS
55
- Core:
66
. Fixed bug #79884 (PHP_CONFIG_FILE_PATH is meaningless). (cmb)
77
. Fixed bug #77932 (File extensions are case-sensitive). (cmb)
8-
. Fixed bug #79806 (realpath() erroneously resolves link to link). (cmb)
98

109
?? ??? ????, PHP 7.3.21
1110

Zend/zend_virtual_cwd.c

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

847847
#ifdef ZEND_WIN32
848-
retry_reparse_point:
849848
if (save) {
850849
pathw = php_win32_ioutil_any_to_w(path);
851850
if (!pathw) {
@@ -868,7 +867,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
868867
tmp = do_alloca(len+1, use_heap);
869868
memcpy(tmp, path, len+1);
870869

871-
retry_reparse_tag_cloud:
870+
retry:
872871
if(save &&
873872
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
874873
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -929,7 +928,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
929928
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
930929
CloseHandle(hLink);
931930
(*ll)--;
932-
goto retry_reparse_tag_cloud;
931+
goto retry;
933932
}
934933
free_alloca(tmp, use_heap);
935934
CloseHandle(hLink);
@@ -1076,15 +1075,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
10761075
free_alloca(pbuffer, use_heap_large);
10771076
free(substitutename);
10781077

1079-
{
1080-
DWORD attrs = GetFileAttributesA(path);
1081-
if (!isVolume && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
1082-
free_alloca(tmp, use_heap);
1083-
FREE_PATHW()
1084-
goto retry_reparse_point;
1085-
}
1086-
}
1087-
10881078
if(isabsolute == 1) {
10891079
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
10901080
/* 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 = dirname(__FILE__);

0 commit comments

Comments
 (0)