@@ -596,6 +596,7 @@ 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 :
599600 if (save ) {
600601 pathw = php_win32_ioutil_any_to_w (path );
601602 if (!pathw ) {
@@ -618,7 +619,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
618619 tmp = do_alloca (len + 1 , use_heap );
619620 memcpy (tmp , path , len + 1 );
620621
621- retry :
622+ retry_reparse_tag_cloud :
622623 if (save &&
623624 !(IS_UNC_PATH (path , len ) && len >= 3 && path [2 ] != '?' ) &&
624625 (dataw .dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT )
@@ -679,7 +680,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
679680 dataw .dwFileAttributes = fileInformation .dwFileAttributes ;
680681 CloseHandle (hLink );
681682 (* ll )-- ;
682- goto retry ;
683+ goto retry_reparse_tag_cloud ;
683684 }
684685 free_alloca (tmp , use_heap );
685686 CloseHandle (hLink );
@@ -826,6 +827,22 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
826827 free_alloca (pbuffer , use_heap_large );
827828 free (substitutename );
828829
830+ {
831+ DWORD attrs ;
832+
833+ FREE_PATHW ()
834+ pathw = php_win32_ioutil_any_to_w (path );
835+ if (!pathw ) {
836+ return (size_t )-1 ;
837+ }
838+ attrs = GetFileAttributesW (pathw );
839+ if (!isVolume && attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_REPARSE_POINT )) {
840+ free_alloca (tmp , use_heap );
841+ FREE_PATHW ()
842+ goto retry_reparse_point ;
843+ }
844+ }
845+
829846 if (isabsolute == 1 ) {
830847 if (!((j == 3 ) && (path [1 ] == ':' ) && (path [2 ] == '\\' ))) {
831848 /* use_realpath is 0 in the call below coz path is absolute*/
0 commit comments