Bug #78939 [NEW]: file_exists produces different results with TS and NTS builds
| From: | michael dot vorisek at email dot cz | Date: | Tue, 10 Dec 2019 11:28:41 +0000 |
| Subject: | Bug #78939 [NEW]: file_exists produces different results with TS and NTS builds | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224185@lists.php.net to get a copy of this message | ||
From: michael dot vorisek at email dot cz
Operating system: Windows
PHP version: 7.3.12
Package: *Directory/Filesystem functions
Bug Type: Bug
Bug description:file_exists produces different results with TS and NTS builds
Description:
------------
After spending a lot of time why PHP app does work on one PC and not on
another, comparing gigabytes of logs, I find very weird behaviour of
core PHP file function.
var_dump(file_exists('C:x.txt'));
if the file "C:/x.txt" exists, PHP produces different results with TS
and NTS builds on Windows if the path is without slash after "C:", i.e.
- output for "C:/x.txt" is corrent and consitent across TS and NTS
builds
- output for "C:x.txt" differs across TS and NTS builds
The path format without slash after "C:" is not supported in
explorer.exe, so for me it seems that paths like "C:something" should be
considered invalid and the TS build should be fixed to always return
false.
Note: other file functions are probably affected too.
Test script:
---------------
// 1. manually create any/empty file and save it under "C:/x.txt"
// 2. run this code with PHP TS and PHP NTS
var_dump(ZEND_THREAD_SAFE);
var_dump(file_exists('C:/x.txt'));
var_dump(file_exists('C:x.txt'));
// 3. notice the different output of the 3rd line
Expected result:
----------------
// expected output from PHP TS and NTS
bool(true) OR bool(false) // dump of ZEND_THREAD_SAFE constant
bool(true)
bool(true) OR bool(false) // TBD, path without slash after "C:" - see
desc., but output need to be consistent across TS and NTS PHP builds
Actual result:
--------------
// output from PHP TS
bool(true)
bool(true)
bool(true)
// output from PHP NTS
bool(false)
bool(true)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=78939&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78939&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78939&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78939&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78939&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78939&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78939&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78939&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78939&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78939&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78939&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78939&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78939&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78939&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78939&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78939&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78939&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78939&r=mysqlcfg