note 80605 deleted from function.clearstatcache by danbrown
| From: | danbrown@php.net | Date: | Sat, 29 Nov 2008 00:59:08 +0000 |
| Subject: | note 80605 deleted from function.clearstatcache by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147413@lists.php.net to get a copy of this message | ||
Note Submitter: stangelanda at gmail dot com
----
It should be noted that a call to any of those functions will cache all of the file's
information, not just the information that is returned.
Obviously it is clear that the following requires you to clear the cache.
<?php
$size1 = filesize($filename);
unlink($filename);
$size2 = filesize($filename);
// $size2 still equals $size1, unless you cleared the stat cache in between.
?>
<?php
$access = fileatime($filename);
unlink($filename);
$size = filesize($filename);
// $size will be the filesize before it was unlinked, because the filesize was cached when
fileatime was called, even though the two functions wouldn't appear to have anything to do with
either other.
?>
Confirmed on a windows system.