php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78220 Can't access OneDrive folder
Submitted: 2019-06-27 12:34 UTC Modified: 2019-09-28 07:13 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: simon dot aberle at mm-bit dot de Assigned: cmb (profile)
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 7.3.6 OS: Windows 10 Pro Version 1903
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: simon dot aberle at mm-bit dot de
New email:
PHP Version: OS:

 

 [2019-06-27 12:34 UTC] simon dot aberle at mm-bit dot de
Description:
------------
If I try to see a folder content via glob or scandir the returning array is empty all the time.

The problem also occurs if I try to load a file via fopen or file_get_contents.

This problem occurs since I did update my OS with the May 2019 update which seems to broke this functionality. Seems like Microsoft did change something on their access rights.

The same problems appear on the computer of one of my colleague after updating his os as well. Running the code on a computer where the newest patch is not installed yet everything just work file.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-27 16:45 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-06-27 16:45 UTC] requinix@php.net
Do you have any specific information besides that it doesn't work? Errors? Process Monitor log?
And are these files hosted on OneDrive?
 [2019-06-28 06:08 UTC] simon dot aberle at mm-bit dot de
-Status: Feedback +Status: Open
 [2019-06-28 06:08 UTC] simon dot aberle at mm-bit dot de
You are totally right the folders I did try to load the data from are hosted via OneDrive but saved on my local HDD.

The only errors I get are the default ones if a file is not present:

PHP Warning:  scandir(): Die Datei oder das Verzeichnis ist kein Analysepunkt. (code: 4390) in
file_get_contents(): failed to open stream: No such file or directory in

I can try to create a process monitor log to track down the problem if you tell me how.
 [2019-06-28 07:35 UTC] simon dot aberle at mm-bit dot de
After some tests I can provide the following additional information

If I run the script with the Windows subsystem for Linux (Ubuntu) the file listing and loading is working just fine. This result is not depending on the OneDrive state (Running/Stopped)

Disabling OneDrive or stopping the sync will not fix the problem with the default Windows command line.
 [2019-06-28 11:05 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2019-08-09 15:45 UTC] cmb@php.net
-Status: Assigned +Status: Verified
 [2019-08-09 18:15 UTC] cmb@php.net
When PHP gets information about the OneDrive folder[1],
dataw.dwFileAttributes is 0x431, which indicates a reparse point.
The folder is then opened[2] to get information about the
reparse point[3].  However, that operation fails with the error
ERROR_NOT_A_REPARSE_POINT.

This happens only when On-Demand is enabled; if it is disabled,
the folder is not reported as a reparse point in the first place.

[1] <https://github.com/php/php-src/blob/php-7.3.8/Zend/zend_virtual_cwd.c#L843>
[2] <https://github.com/php/php-src/blob/php-7.3.8/Zend/zend_virtual_cwd.c#L886>
[3] <https://github.com/php/php-src/blob/php-7.3.8/Zend/zend_virtual_cwd.c#L906>
 [2019-08-19 12:52 UTC] cmb@php.net
-Summary: Can't save to file system outside of project folder +Summary: Can't access OneDrive folder
 [2019-08-19 12:52 UTC] cmb@php.net
I have now compared the behavior of Windows 10 1809, and while the
OneDrive folder (on-demand enabled) is reported as reparse point
by `fsutil` and `dir /al`, FindFirstFile() doesn't report it as
reparse point, so there are no issues accessing the folder.
 [2019-08-19 18:00 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=81f52158b42318f17f67468cccc4a8dc03bba942
Log: Fix #78220: Can't access OneDrive folder
 [2019-08-19 18:00 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2019-09-10 21:08 UTC] tbyte at outlook dot com
Hi. 

Maybe I miss something, but it's not clear if this problem is fixed.
Please let me know.

Thanks for your help!
 [2019-09-10 21:30 UTC] cmb@php.net
This issue will be fixed in PHP 7.2.23 and 7.3.10, which will both be released in roughly two weeks.
 [2019-09-23 18:15 UTC] indurain4 at hotmail dot com
I can confirm that the OneDrive issue is corrected in 7.2.23RC1, Windows download https://windows.php.net/qa/. Windows 10 Pro, Version 1903, OS Build 18362.356

FileIncludeTest.php
<?php
require 'c:/OneDrive/common_include/environment.php';
echo 'OK!';

Error on PHP 7.2.22:

C:..\test>c:\xampp72\php7.2.22\php .\FileIncludeTest.php
PHP Warning:  require(c:/OneDrive/common_include/environment.php): failed to open stream: No such file or directory in .\FileIncludeTest.php on line 2
PHP Fatal error:  require(): Failed opening required 'c:/OneDrive/common_include/environment.php' (include_path='C:\xampp72\php\PEAR') in .\FileIncludeTest.php on line 2

---

On PHP 7.2.23RC1:

C:..\test>c:\xampp72\php7.2.23\php .\FileIncludeTest.php
OK!
 [2019-09-27 15:12 UTC] tbyte at outlook dot com
This thing is drive my crazy. 
indurain4 at hotmail dot com replied that this bug is corrected in 7.2.23RC1

But I really don't understand how to solve it. Please, be more specific about how to update PHP in Xampp.

I just updated Xampp completely, and now it seems PHP7 is installed, but I followed instructions to update PHP and it was impossible. 

If the bug is corrected in 7.2.23RC1, please let us know how to update it, because its not clear or detailed here https://windows.php.net/qa/

Thanks in advance!
 [2019-09-27 15:22 UTC] cmb@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.
 [2019-09-27 15:31 UTC] bugreports at gmail dot com
> Please, be more specific about how to update PHP in Xampp

Here you go: https://community.apachefriends.org/f/viewforum.php?f=16
 [2019-09-27 15:49 UTC] tbyte at outlook dot com
Ok,
Thanks for your reply.

I will try to find solution/make question there.

Thanks again.
Best.
 [2019-09-27 19:54 UTC] tbyte at outlook dot com
I want to confirm that updating PHP doesn't fix the problem.

Doing what indurain4 at hotmail dot com suggested, I updated PHP to PHP 7.3 (7.3.10), and it makes no difference.

When I try to open a PHP site inside OneDrive folders, it gives the error:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/Users/xxxx/OneDrive/www/index.php' (include_path='C:\xampp\php\PEAR') in Unknown on line 0
 [2019-09-28 07:13 UTC] cmb@php.net
Can you please explain exactly what you're trying to do?  Does
Apache's DocumentRoot point inside the OneDrive Folder?  A small
reproduce script could be helpful.
 [2019-10-15 00:28 UTC] tbyte at outlook dot com
I'm trying to do something very basic. Run a simple PHP site. It worked just fine before Windows May 2019 Update. If you open index.php (located outside OneDrive folder) it work fine. But, if index.php (an the whole website) is inside OneDrive, it won't work.

"Does Apache's DocumentRoot point inside the OneDrive Folder?" - No, DocumentRoot is C:\ - (and always was).

But, since I have all my work synced in OneDrive, I need this problem to be fixed, or I will have to move all my files everytime I need to work with my sites, which is crazy.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC