|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2007-06-19 01:45 UTC] php-bug at okra dot org
 Description:
------------
file_exists() returns strange results in PHP 5.2.3. This worked fine in 5.2.1. The "Actual result" below is from PHP 5.2.1 on the same server.
Reproduce code:
---------------
<?php
header('Content-type: text/plain');
foreach (array('d:/home', 'd:/home/domain.com', 'd:/home/domain.com/phpinfo.php', 'c:/WINDOWS', 'c:/WINDOWS/system32', 'c:/bogus') as $file) {
  echo "$file: " . (file_exists($file) ? 'yes' : 'no' ) . "\n";
}
?>
Expected result:
----------------
d:/home: yes
d:/home/domain.com: yes
d:/home/domain.com/phpinfo.php: yes
c:/WINDOWS: yes
c:/WINDOWS/system32: yes
c:/bogus: no
Actual result:
--------------
d:/home: yes
d:/home/domain.com: no
d:/home/domain.com/phpinfo.php: yes
c:/WINDOWS: no
c:/WINDOWS/system32: yes
c:/bogus: no
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
Here's a batch file for the reproducibly challenged: mkdir unlistable mkdir unlistable\subdir echo Hello > unlistable\subdir\file echo y| cacls unlistable\subdir /g "%USERNAME%":F echo y| cacls unlistable /d "%USERNAME%" php -r "print file_exists('unlistable').\"\n\";" php -r "print file_exists('unlistable\subdir').\"\n\";" php -r "print file_exists('unlistable\subdir\file').\"\n\";" Output is 1, blank, 1.