Edit report at https://bugs.php.net/bug.php?id=79486&edit=1
ID: 79486
Comment by: m dot staab at complex-it dot de
Reported by: m dot staab at complex-it dot de
Summary: file_exists() returns true for a non-existing file
Status: Assigned
Type: Bug
Package: *General Issues
Operating System: windows10 x64
PHP Version: 7.4.5
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I dont have a buildenv on my workstation (and actually dont want to setup one).
Anything else I could do to to ahead?
I thought about downloading a 7.2 and/or 7.3 binary to test whether the issue was present before.
I could offer a teamviewer pairing session, so you can have a look at it right on the machine..
Previous Comments:
------------------------------------------------------------------------
[2020-04-18 10:41:31] cmb@php.net
Thanks for the further info!
Since this issue is obviously not easily reproducible, and I have
doubts that tracing with Process Monitor[1] will reveal the
underlying issue, I can only speculate. As of PHP 7.4.0, the
stat() call (either explicitly or implictly) ends up in
php_win32_ioutil_fstat_int()[2], and given that that the uid and
gid members are not zero, it looks like your hitting the
_fstat64() fallback[3]. This code path uses _open_osfhandle(),
but apparently doesn't regard that "The _open_osfhandle call
transfers ownership of the Win32 file handle to the file
descriptor."[4] If the documentation is correct, this might
indeed cause issues.
Would you have a PHP build environment[5] available, to do some
debugging, or trying out some potential fixes? Otherwise I could
try to apply fixes, and provide pre-built binaries for testing,
but that would be somewhat tedious.
[1] <https://docs.microsoft.com/en-us/sysinternals/downloads/procmon>
[2] <https://github.com/php/php-src/blob/php-7.4.5/win32/ioutil.c#L860>
[3] <https://github.com/php/php-src/blob/php-7.4.5/win32/ioutil.c#L872-L888>
[4] <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-osfhandle?view=vs-2019>
[5] <https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2>
------------------------------------------------------------------------
[2020-04-18 06:47:54] m dot staab at complex-it dot de
Btw: I tried adding clearstatcache(true); right before the file_exists(), but this did not change
the result
------------------------------------------------------------------------
[2020-04-18 06:14:24] m dot staab at complex-it dot de
Not that I am aware of.
C:\Users\mstaab\Documents\GitHub\kunzmann is a regular git checkout of a private github repo
I am wondering why its not reproducible with a 3 line script from within the same path
------------------------------------------------------------------------
[2020-04-17 17:30:56] cmb@php.net
> ["uid"]=>
> int(1000)
> ["gid"]=>
> int(1000)
Huh, that's interesting. These values are supposed to be zero on
Windows. Is there any reparse point (symlink, mounted volume, VFS
for Git etc.) involved in the path?
------------------------------------------------------------------------
[2020-04-17 12:28:40] m dot staab at complex-it dot de
you are right... opcache is disabled..
$ php -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
filter
hash
iconv
json
libxml
mysqlnd
pcre
PDO
Phar
readline
Reflection
session
SimpleXML
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
$ php -v
PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:19) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=79486
--
Edit this bug report at https://bugs.php.net/bug.php?id=79486&edit=1