php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41735 file_exists reports incorrect results
Submitted: 2007-06-19 01:45 UTC Modified: 2007-07-04 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: php-bug at okra dot org Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 5.2.3 OS: Windows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php-bug at okra dot org
New email:
PHP Version: OS:

 

 [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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-19 01:47 UTC] php-bug at okra dot org
Correction: The "Expected result" below is from PHP 5.2.1.
 [2007-06-26 08:01 UTC] php-bug at okra dot org
No change with the snapshot (5.2.4-dev).

FYI, this bug also exists in PHP 4.4.7 and 4.4.6. I'm not sure about earlier versions of PHP 4.

As mentioned in the original bug report, it did NOT exist in PHP 5.2.1.
 [2007-06-26 12:17 UTC] tony2001@php.net
Not reproducible.
 [2007-06-26 22:55 UTC] stas@php.net
It would be useful to know permissions on all involved directories and also the user under which the test was done.
 [2007-07-04 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2007-07-22 19:23 UTC] tstarling at wikimedia dot org
This is reproducible by denying the "list folder contents" right for d:\home but allowing it for d:\home\domain.com. This surely must be a common setup for shared hosts.
 [2007-07-22 20:05 UTC] tstarling at wikimedia dot org
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC