Skip to content

Commit f025074

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Revert "Fix #79806: realpath() erroneously resolves link to link"
2 parents 85a26fe + 1aeff52 commit f025074

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
06 Aug 2020, PHP 7.4.9
1110

Zend/zend_virtual_cwd.c

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

598598
#ifdef ZEND_WIN32
599-
retry_reparse_point:
600599
if (save) {
601600
pathw = php_win32_ioutil_any_to_w(path);
602601
if (!pathw) {
@@ -619,7 +618,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
619618
tmp = do_alloca(len+1, use_heap);
620619
memcpy(tmp, path, len+1);
621620

622-
retry_reparse_tag_cloud:
621+
retry:
623622
if(save &&
624623
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
625624
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
@@ -680,7 +679,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
680679
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
681680
CloseHandle(hLink);
682681
(*ll)--;
683-
goto retry_reparse_tag_cloud;
682+
goto retry;
684683
}
685684
free_alloca(tmp, use_heap);
686685
CloseHandle(hLink);
@@ -827,15 +826,6 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
827826
free_alloca(pbuffer, use_heap_large);
828827
free(substitutename);
829828

830-
{
831-
DWORD attrs = GetFileAttributesA(path);
832-
if (!isVolume && (attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
833-
free_alloca(tmp, use_heap);
834-
FREE_PATHW()
835-
goto retry_reparse_point;
836-
}
837-
}
838-
839829
if(isabsolute == 1) {
840830
if (!((j == 3) && (path[1] == ':') && (path[2] == '\\'))) {
841831
/* 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)