#33610 [Opn->Bgs]: stat cache can cause problems after changing directory
| From: | tony2001@php.net | Date: | Thu, 07 Jul 2005 21:17:59 +0000 |
| Subject: | #33610 [Opn->Bgs]: stat cache can cause problems after changing directory | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-81557@lists.php.net to get a copy of this message | ||
ID: 33610
Updated by: tony2001@php.net
Reported By: steve at nexusuk dot org
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Linux (Fedora Core 4)
PHP Version: 5.0.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Use clearstatcache().
Previous Comments:
------------------------------------------------------------------------
[2005-07-07 23:07:37] steve at nexusuk dot org
Description:
------------
If you use relative path names and change the working directory then
the cached data may point at the wrong file.
Reproduce code:
---------------
$a = file_exists('foo.txt');
chdir('bar');
$b = file_exists('foo.txt');
Expected result:
----------------
The second file_exists() call should check the file exists since it is
not the same file as the original call.
The stat cache should probably reference files by their absolute path
names, or chdir() should clear the stat cache to ensure this doesn't
happen.
Actual result:
--------------
If 'foo.txt' existed when checked the first time then the second
file_exists() call will also return true, even if 'bar/foo.txt' doesn't
exist.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33610&edit=1