#27134 [Com]: PHP CLI does not cache results of file_exists()
| From: | djani22 at netcenter dot hu | Date: | Wed, 08 Sep 2004 15:57:28 +0000 |
| Subject: | #27134 [Com]: PHP CLI does not cache results of file_exists() | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969363895@lists.php.net to get a copy of this message | ||
ID: 27134
Comment by: djani22 at netcenter dot hu
Reported By: jaenecke@php.net
Status: Closed
Bug Type: Documentation problem
Operating System: Slackware Linux
PHP Version: 4.3.4
New Comment:
I have a similar problem too:
...
clearstatcache();
if
(file_exists($_SERVER['DOCUMENT_ROOT']."pic/penztarbamost_".$language.".gif")){
?>
<img src="pic/penztarbamost_<?php echo($language); ?>.gif" border="0"
alt="<?php
echo($_SERVER['DOCUMENT_ROOT']."pic/penztarbamost_".$language.".gif");
?>">
<?php }
...
The code is inserting the img tag, but the image does not exist!
(and newer was)
I tried to restart apache, but no change. :(
(the php script is a symlink, but the alt message on a missing image is
correct.)
PHP 4.3.6RC2
RH 9.0
Apache 2.0.50
Previous Comments:
------------------------------------------------------------------------
[2004-02-05 14:39:14] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
------------------------------------------------------------------------
[2004-02-04 12:56:48] wez@php.net
Results are only cached if the underlying stat() call succeeded; since
the file doesn't exist to start off with,
PHP won't cached the information about it not existing.
------------------------------------------------------------------------
[2004-02-03 10:22:51] nlopess@php.net
I've tested with PHP 5 and it caches in some situations.
If you start running the script without the file, it will output false
till you create it.
If you then delete the file, it continues to echo true.
------------------------------------------------------------------------
[2004-02-03 10:12:19] jaenecke@php.net
Description:
------------
It seems that results from file_exists() or similar are not being
cached with PHP-CLI. Since I think this is intended behavior this
should be reflected in the manual.
Reproduce code:
---------------
while( TRUE ) {
var_dump( file_exists( '/tmp/foo' ) );
sleep( 1 );
}
Expected result:
----------------
on creating/deleting /tmp/foo the result of file_exists() should not
change since there is no call to clearstatcache()
Actual result:
--------------
actually the output _does_ change
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27134&edit=1