Skip to content

Commit ed64d1b

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fix #80258: Windows Deduplication Enabled, randon permission errors
2 parents 02632a5 + 0abcb9f commit ed64d1b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Zend/zend_virtual_cwd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void)
486486
static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, bool is_dir, int *link_is_dir) /* {{{ */
487487
{
488488
size_t i, j;
489-
int directory = 0, save;
489+
int directory = 0, save, may_retry_reparse_point;
490490
#ifdef ZEND_WIN32
491491
WIN32_FIND_DATAW dataw;
492492
HANDLE hFind = INVALID_HANDLE_VALUE;
@@ -591,6 +591,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
591591

592592
#ifdef ZEND_WIN32
593593
retry_reparse_point:
594+
may_retry_reparse_point = 0;
594595
if (save) {
595596
pathw = php_win32_ioutil_any_to_w(path);
596597
if (!pathw) {
@@ -685,6 +686,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
685686
CloseHandle(hLink);
686687

687688
if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
689+
may_retry_reparse_point = 1;
688690
reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget;
689691
isabsolute = pbuffer->SymbolicLinkReparseBuffer.Flags == 0;
690692
#if VIRTUAL_CWD_DEBUG
@@ -821,7 +823,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
821823
free_alloca(pbuffer, use_heap_large);
822824
free(substitutename);
823825

824-
{
826+
if (may_retry_reparse_point) {
825827
DWORD attrs;
826828

827829
FREE_PATHW()

0 commit comments

Comments
 (0)