#34589 [Opn->Bgs]: Strange effects of file_exists() etc. caching

From: Date: Wed, 21 Sep 2005 20:02:03 +0000
Subject: #34589 [Opn->Bgs]: Strange effects of file_exists() etc. caching
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85384@lists.php.net to get a copy of this message
ID: 34589 Updated by: tony2001@php.net Reported By: pjf at asn dot pl -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: GNU PHP Version: 5.0.5 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() to clear the cache. Previous Comments: ------------------------------------------------------------------------ [2005-09-21 21:55:45] pjf at asn dot pl I made mistake in the code - here is the corrected version: touch("foobar"); echo file_exists("foobar") . "\n"; mkdir("foodir"); chdir("foodir"); echo file_exists("foobar") . "\n"; ------------------------------------------------------------------------ [2005-09-21 21:51:41] pjf at asn dot pl Description: ------------ I find caching of file_exists() and similar functions causing strange results - as presented by attached code, it might cause unexistent files to... "exist" :). Reproduce code: --------------- [pjf@boogoo file_exists]$ ls file_exists.php [pjf@boogoo file_exists]$ cat file_exists.php <?php touch("foobar"); echo file_exists("foobar") . "\n"; mkdir("foodir"); echo file_exists("foobar") . "\n"; ?> Expected result: ---------------- [pjf@boogoo file_exists]$ php file_exists.php 1 Actual result: -------------- [pjf@boogoo file_exists]$ php file_exists.php 1 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34589&edit=1

« previous php.bugs (#85384) next »