Bug #76877 [NEW]: file_exists() don't see hosts file

From: Date: Thu, 13 Sep 2018 13:13:08 +0000
Subject: Bug #76877 [NEW]: file_exists() don't see hosts file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217030@lists.php.net to get a copy of this message
From: dominique at ottello dot net Operating system: Windows 7 64bit PHP version: 7.3.0RC1 Package: *General Issues Bug Type: Bug Bug description:file_exists() don't see hosts file Description: ------------ PHP 7.3.0rc1 32 bit on Windows 7 64 bit Return false for file_exists('c:/windows/system32/drivers/etc/hosts'); or is_writable('c:/windows/system32/drivers/etc/hosts'); although we can open this file or take its content by file() or file_get_contents() and even modify it with fwrite(). I have never encountered this problem with any other version of PHP, including 7.2.10 32 bit. I went back to the first version PHP 7.3.0alpha2 which has the same problem. Test script: --------------- $c_hostsFile = str_replace("\\","/",getenv('WINDIR').'/system32/drivers/etc/hosts'); // Check file_exists $i = 1; $def = 0; do { clearstatcache(); if(!file_exists($c_hostsFile)) { echo "File ".$c_hostsFile." DOES NOT EXISTS - Test number ".$i."<br>"; $def++; } $del = rand(100,500)*1000; //echo "Test number ".$i." Delay ".($del/1000)." ms<br>"; usleep($del); $i++; } while ($i < 100 && $def < 10); echo $i." tests<br>"; Expected result: ---------------- --- Windows NT 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) x64 64bit--- --- Serveur Apache/2.4.34 (Win32) PHP/7.3.0RC1 --- --- PHP version 7.3.0RC1 32bit ---- 100 tests Actual result: -------------- --- Windows NT 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) x64 64bit--- --- Serveur Apache/2.4.34 (Win32) PHP/7.3.0RC1 --- --- PHP version 7.3.0RC1 32bit ---- File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 1 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 2 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 3 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 4 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 5 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 6 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 7 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 8 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 9 File C:/Windows/system32/drivers/etc/hosts DOES NOT EXISTS - Test number 10 11 tests -- Edit bug report at https://bugs.php.net/bug.php?id=76877&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76877&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76877&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76877&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76877&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76877&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76877&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76877&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76877&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76877&r=support Expected behavior: https://bugs.php.net/fix.php?id=76877&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76877&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76877&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76877&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76877&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76877&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76877&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76877&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76877&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76877&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76877&r=mysqlcfg

« previous php.bugs (#217030) next »