Skip to content

Commit c6720e2

Browse files
committed
Fixed #75384 PHP seems incompatible with OneDrive files on demand
1 parent ca0bcf5 commit c6720e2

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Zend/zend_virtual_cwd.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@
4545
# define IO_REPARSE_TAG_DEDUP 0x80000013
4646
# endif
4747

48+
# ifndef IO_REPARSE_TAG_CLOUD
49+
# define IO_REPARSE_TAG_CLOUD (0x9000001AL)
50+
# endif
51+
/* IO_REPARSE_TAG_CLOUD_1 through IO_REPARSE_TAG_CLOUD_F have values of 0x9000101AL
52+
to 0x9000F01AL, they can be checked against the mask. */
53+
#ifndef IO_REPARSE_TAG_CLOUD_MASK
54+
#define IO_REPARSE_TAG_CLOUD_MASK (0x0000F000L)
55+
#endif
56+
57+
#ifndef IO_REPARSE_TAG_ONEDRIVE
58+
#define IO_REPARSE_TAG_ONEDRIVE (0x80000021L)
59+
#endif
60+
4861
# ifndef VOLUME_NAME_NT
4962
# define VOLUME_NAME_NT 0x2
5063
# endif
@@ -908,7 +921,7 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
908921
return -1;
909922
}
910923

911-
hLink = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
924+
hLink = CreateFile(path, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, NULL);
912925
if(hLink == INVALID_HANDLE_VALUE) {
913926
return -1;
914927
}
@@ -977,7 +990,11 @@ static int tsrm_realpath_r(char *path, int start, int len, int *ll, time_t *t, i
977990
};
978991
substitutename[substitutename_len] = 0;
979992
}
980-
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP) {
993+
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
994+
/* Starting with 1709. */
995+
(pbuffer->ReparseTag & IO_REPARSE_TAG_CLOUD_MASK) != 0 && 0x90001018L != pbuffer->ReparseTag ||
996+
IO_REPARSE_TAG_CLOUD == pbuffer->ReparseTag ||
997+
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
981998
isabsolute = 1;
982999
memcpy(substitutename, path, len + 1);
9831000
substitutename_len = len;

0 commit comments

Comments
 (0)