Re: Bug #1428: file_exists(), filesize() and while(1) loops
| From: | Lars Torben Wilson | Date: | Thu, 20 May 1999 03:41:13 +0000 |
| Subject: | Re: Bug #1428: file_exists(), filesize() and while(1) loops | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-5803@lists.php.net to get a copy of this message | ||
brettw@cs.rmit.edu.au writes:
> From: brettw@cs.rmit.edu.au
> Operating system: FreeBSD-3.1R
> PHP version: 3.0.7
> PHP Bug Type: Misbehaving function
> Bug description: file_exists(), filesize() and while(1) loops
>
> while(1){
> if(file_exists("tick")){
> exec("mv tick tock");
> }else{
> pritnf("Not my turn\n");
> }
This is not a bug; it's explained in the docs for the clearstatcache()
function (which is the only 'See also' in the docs for file_exists()).
http://www.php.net/manual/function.clearstatcache.php3
The upshot is that file stats are cached unless you clear the cache,
since they're so expensive.
Call clearstatcache() at the top of your loop and you should be
laughing.
Torben
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net