mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78220: Can't access OneDrive folder
This commit is contained in:
commit
3775d47eee
3 changed files with 35 additions and 2 deletions
1
NEWS
1
NEWS
|
@ -3,6 +3,7 @@ PHP NEWS
|
||||||
?? ??? ????, PHP 7.4.0beta3
|
?? ??? ????, PHP 7.4.0beta3
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Fixed bug #78220 (Can't access OneDrive folder). (cmb, ab)
|
||||||
. Fixed bug #78396 (Second file_put_contents in Shutdown hangs script).
|
. Fixed bug #78396 (Second file_put_contents in Shutdown hangs script).
|
||||||
(Nikita)
|
(Nikita)
|
||||||
. Fixed bug #78406 (Broken file includes with user-defined stream filters).
|
. Fixed bug #78406 (Broken file includes with user-defined stream filters).
|
||||||
|
|
|
@ -93,6 +93,8 @@ static cwd_state main_cwd_state; /* True global */
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#else
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#include "zend_globals.h"
|
||||||
|
#include "zend_globals_macros.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CWD_STATE_COPY(d, s) \
|
#define CWD_STATE_COPY(d, s) \
|
||||||
|
@ -608,6 +610,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||||
tmp = do_alloca(len+1, use_heap);
|
tmp = do_alloca(len+1, use_heap);
|
||||||
memcpy(tmp, path, len+1);
|
memcpy(tmp, path, len+1);
|
||||||
|
|
||||||
|
retry:
|
||||||
if(save &&
|
if(save &&
|
||||||
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
!(IS_UNC_PATH(path, len) && len >= 3 && path[2] != '?') &&
|
||||||
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
(dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
||||||
|
@ -655,7 +658,21 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||||
return (size_t)-1;
|
return (size_t)-1;
|
||||||
}
|
}
|
||||||
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &retlength, NULL)) {
|
||||||
|
BY_HANDLE_FILE_INFORMATION fileInformation;
|
||||||
|
|
||||||
free_alloca(pbuffer, use_heap_large);
|
free_alloca(pbuffer, use_heap_large);
|
||||||
|
if ((dataw.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
|
||||||
|
(dataw.dwReserved0 & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD &&
|
||||||
|
EG(windows_version_info).dwMajorVersion >= 10 &&
|
||||||
|
EG(windows_version_info).dwMinorVersion == 0 &&
|
||||||
|
EG(windows_version_info).dwBuildNumber >= 18362 &&
|
||||||
|
GetFileInformationByHandle(hLink, &fileInformation) &&
|
||||||
|
!(fileInformation.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
||||||
|
dataw.dwFileAttributes = fileInformation.dwFileAttributes;
|
||||||
|
CloseHandle(hLink);
|
||||||
|
(*ll)--;
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
free_alloca(tmp, use_heap);
|
free_alloca(tmp, use_heap);
|
||||||
CloseHandle(hLink);
|
CloseHandle(hLink);
|
||||||
FREE_PATHW()
|
FREE_PATHW()
|
||||||
|
@ -735,8 +752,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
|
||||||
}
|
}
|
||||||
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
|
else if (pbuffer->ReparseTag == IO_REPARSE_TAG_DEDUP ||
|
||||||
/* Starting with 1709. */
|
/* Starting with 1709. */
|
||||||
(pbuffer->ReparseTag & IO_REPARSE_TAG_CLOUD_MASK) != 0 && 0x90001018L != pbuffer->ReparseTag ||
|
(pbuffer->ReparseTag & ~IO_REPARSE_TAG_CLOUD_MASK) == IO_REPARSE_TAG_CLOUD ||
|
||||||
IO_REPARSE_TAG_CLOUD == pbuffer->ReparseTag ||
|
|
||||||
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
|
IO_REPARSE_TAG_ONEDRIVE == pbuffer->ReparseTag) {
|
||||||
isabsolute = 1;
|
isabsolute = 1;
|
||||||
substitutename = malloc((len + 1) * sizeof(char));
|
substitutename = malloc((len + 1) * sizeof(char));
|
||||||
|
|
16
ext/standard/tests/dir/bug78220.phpt
Normal file
16
ext/standard/tests/dir/bug78220.phpt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #78220 (Can't access OneDrive folder)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$onedrive_dirs = array_unique([getenv('OneDrive'), getenv('OneDriveCommercial')]);
|
||||||
|
foreach ($onedrive_dirs as $dir) {
|
||||||
|
if ($dir && scandir($dir) === FALSE) {
|
||||||
|
echo "can't scan $dir\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
Loading…
Add table
Add a link
Reference in a new issue