php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75384 PHP seems incompatible with OneDrive files on demand
Submitted: 2017-10-15 18:01 UTC Modified: 2019-08-13 16:27 UTC
Votes:11
Avg. Score:5.0 ± 0.0
Reproduced:11 of 11 (100.0%)
Same Version:7 (63.6%)
Same OS:11 (100.0%)
From: phpbugs at dougweb dot org Assigned: ab (profile)
Status: Closed Package: *Directory/Filesystem functions
PHP Version: 7.1.10 OS: Windows 10
Private report: No CVE-ID: None
 [2017-10-15 18:01 UTC] phpbugs at dougweb dot org
Description:
------------
It would seem that the new "Files on Demand" feature of OneDrive in the Windows fall update causes issues with PHP's ability to open files. In theory according to MS this should be invisible to applications but there's definitely something screwy going on with PHP.

(https://support.office.com/en-us/article/Learn-about-OneDrive-Files-On-Demand-0e6860d3-d9f3-4971-b321-7092438fb38e?ui=en-US&rs=en-US&ad=US&fromAR=1).

Any attempt to iterate through files in a folder, or even simply do a "require" results in PHP somehow not being able to see them. This applies even if the files are locally available on the PC, the only thing needed to trigger this is to have Files on Demand enabled and to have the source located somewhere within the OneDrive folder.

Moving the source code to any other folder makes things work normally. 

Weirdly, PHP does seem to be able to read the initial file it's asked to execute, it's only secondary files it's unable to load.

This may or may not help debugging, but if I install Ubuntu into Windows 10 via the Windows Store, and execute PHP scripts in the OneDrive folder from Linux (so PHP is using the Linux file APIs, with the MS shim converting them to the Windows ones) then that works fine.


Test script:
---------------
1) On a recent Windows Insider Build (or wait until RTM in a few days)
2) Enable OneDrive, and the "Files on Demand" feature

Then in your OneDrive folder, create 2 files

Foo.php
<?php
require 'Bar.php';


Bar.php
<?php
echo 'Require worked';


Then run php Foo.php

Expected result:
----------------
See "Require worked" output to the screen

Actual result:
--------------
PHP Warning:  require(Bar.php): failed to open stream: No such file or directory
 in Foo.php on line 2

Warning: require(Bar.php): failed to open stream: No such file or directory in F
oo.php on line 2
PHP Fatal error:  require(): Failed opening required 'Bar.php' (include_path='.;
C:\php\pear') in Foo.php on line 2

Fatal error: require(): Failed opening required 'Bar.php' (include_path='.;C:\ph
p\pear') in Foo.php on line 2


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-19 17:43 UTC] info at sillevl dot be
I can confirm this issue. 

The problem exist after upgrading Windows fall creators update 1709. I have upgraded 2 PC's to this version. On the first one, the Onedrive update (build 17.3.7073.1013) that supports the "Files on Demand" feature , is installed. On the second one, Onedrive (build 17.3.6998.0830) does not support the "Files on Demand" feature. On both the problem exists. This seems to suggest the cause of the problem is introduced by the Windows update, and is not depending on the Onedrive version.
I can also confirm that the problem does not exist on files that are not in a Onedrive directory.
 [2017-10-22 07:16 UTC] info at sillevl dot be
I have added a comment on github on the code that might be the source of the problem: https://github.com/php/php-src/commit/065edced71c7f15f32fc2fb483a9048328b8108e#commitcomment-25110205
 [2017-11-02 04:21 UTC] simbiat at bk dot ru
I think this is not OneDrive related. I moved htdocs to 1 directory above OneDrive (that is C:\users\username\htdocs) but still get the same error. When I move it to C:\htdocs - it works fine. I think there is something wrong with permissions, that PHP gets from Apache, even though, Apache can access the files normally. Tried setting php.exe to run under admin (Compatibility mode), but that did not help, either.

Warning like
PHP Warning:  Unknown: failed to open stream: Operation not permitted in Unknown on line 0

Only support that PHP can't access the file. And the funny thing is: if I look at the folders in Total Commander it shows them as... Links. And SymLink following is allowed in configuration file.
 [2017-11-02 17:35 UTC] simbiat at bk dot ru
I figured out why it was not working for me when I moved htdocs. It was moved by Windows in a way, that Windows treated it as it was still in OneDrive. I ran

dir /AL c:\Users\username\

which is expected to show all "links" and it listed htdocs as "DIR". I moved it away, created a directory manually and reran the command: htdocs was not there. In both cases OneDrive was there as "DIR".
Note that /AL flag should NOT list "DIR". Meaning, that there is something different with those OneDrive directories (obviously). I dunno how to see what exactly.
 [2017-11-02 17:41 UTC] simbiat at bk dot ru
BTW, the same thing affects MySQL: Fatal error: Can't open and lock privilege tables: Table storage engine for 'user' doesn't have this optionFor more information, see Help and Support Center at http://www.mysql.com.
 [2017-11-07 18:36 UTC] ab@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: ab
 [2017-11-07 18:36 UTC] ab@php.net
I've uploaded a test program here http://windows.php.net/downloads/snaps/ostc/75384/

Please download it and invoke on console like this

read_reparse_tag C:\Users\<my user>\OneDrive\

Then post the output.

Thanks.
 [2017-11-07 21:14 UTC] valentino dot delapa at tiscali dot it
On my computer the command execution result is this:

GetFileInformationByHandleEx: CreateFile failed
FindFirstFileEx: IO_REPARSE_TAG_CLOUD_3(9000301a)
 [2017-11-07 21:40 UTC] phpbugs at dougweb dot org
-Status: Feedback +Status: Assigned
 [2017-11-07 21:40 UTC] phpbugs at dougweb dot org
I got
        GetFileInformationByHandleEx: IO_REPARSE_TAG_CLOUD_7(9000701a)
        FindFirstFileEx: IO_REPARSE_TAG_CLOUD_7(9000701a)

Hope that helps?
 [2017-11-07 21:44 UTC] phpbugs at dougweb dot org
Although trying with a couple of folders within OneDrive, I have had a few different results come up too

        GetFileInformationByHandleEx: IO_REPARSE_TAG_CLOUD_E(9000e01a)
        FindFirstFileEx: IO_REPARSE_TAG_CLOUD_E(9000e01a)

        GetFileInformationByHandleEx: IO_REPARSE_TAG_CLOUD_6(9000601a)
        FindFirstFileEx: IO_REPARSE_TAG_CLOUD_6(9000601a)
 [2017-11-07 21:53 UTC] valentino dot delapa at tiscali dot it
I found that if I use the path "C:\Users\<my user>\OneDrive\" the result is what I posted earlier, that is:

GetFileInformationByHandleEx: CreateFile failed
FindFirstFileEx: IO_REPARSE_TAG_CLOUD_3(9000301a)

while if I delete the last "\" making path "C:\Users\<my user>\OneDrive" the result is:

GetFileInformationByHandleEx: IO_REPARSE_TAG_CLOUD_3(9000301a)
FindFirstFileEx: IO_REPARSE_TAG_CLOUD_3(9000301a)
 [2017-11-07 23:00 UTC] ab@php.net
Thanks very much for a quick check, folks. It's indeed an incompatibility introduced with the version 1709. The issue is identified, a fix is under way.

Thanks.
 [2017-11-08 11:02 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c6720e2f4542bf1e65567229d9155cc4fd047c45
Log: Fixed #75384 PHP seems incompatible with OneDrive files on demand
 [2017-11-08 11:02 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2017-11-08 11:03 UTC] ab@php.net
-Status: Closed +Status: Re-Opened
 [2017-11-08 14:10 UTC] ab@php.net
-Status: Re-Opened +Status: Feedback
 [2017-11-08 14:10 UTC] ab@php.net
A fix for this has landed in the latest today's snapshots. Please check.

Thanks.
 [2017-11-08 20:19 UTC] phpbugs at dougweb dot org
-Status: Feedback +Status: Assigned
 [2017-11-08 20:19 UTC] phpbugs at dougweb dot org
Yes, I can confirm that seems to have fixed it.

Many thanks!
 [2017-11-10 10:36 UTC] ab@php.net
-Status: Assigned +Status: Closed
 [2017-11-10 10:36 UTC] ab@php.net
Thanks for checking! Since there are no other responses and the reporter signaled it's fixed, considering it as done. Further tests are welcome.

Thanks.
 [2017-11-11 16:38 UTC] webmaster at baypatchers dot org dot uk
Hi,

Sorry for the delay in responding, but I had had to move my files to another sharing system in order to continue development.

I have now had the chance to install the snapshot and move some files back to test and  .... perfect!!

Thanks for the quick response.
 [2017-11-12 11:04 UTC] ab@php.net
@webmaster at baypatchers dot org dot uk, thanks for mentioning your test results anyway :)
 [2017-11-14 03:03 UTC] mattficken@php.net
Its fixed for me on Windows 10 Desktop.

FYI: The `Files On Demand` feature of OneDrive isn't supported on Windows Server.
 [2017-12-18 06:29 UTC] cameron_eldridge at hotmail dot com
FYI, looks like this bug still exists in the latest version for 7.0 (7.0.26), not sure if the patch has made it back to 7 yet?
 [2017-12-18 06:36 UTC] cameron_eldridge at hotmail dot com
Sorry, scratch that, I can see it in the snapshot only for 7.0, thought it had made it through to GA...
 [2019-06-20 14:47 UTC] tbye at outlook dot com
Hi
This same problem started again with Windows May 2019 Update. I have 2 laptops, one of them was updated and I did a restore (So, it's clean Windows 10 May 2019 Update)- The same problem is here again... Please help!
 [2019-06-23 11:49 UTC] phpbugs at dougweb dot org
Yes, I can confirm upgrading Win10 to the May update has also reintroduced this issue for me too :(

As this bug is closed, and also did fix it for the previous update I suggest opening a new one tbye at outlook dot com as this issue otherwise isn't likely to show up on the maintainer's radar.
 [2019-08-13 16:27 UTC] cmb@php.net
For those experiencing issues with accessing OneDrive folders after the May update, please head over to bug #78220, where we're working on a fix.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 17:01:29 2024 UTC