Re: broken stat cache?
| From: | Yasuo Ohgaki | Date: | Wed, 25 Sep 2002 02:20:22 +0000 |
| Subject: | Re: broken stat cache? | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-88581@lists.php.net to get a copy of this message | ||
Try again with system() and delete/change file stat.
strace also shows PHP is calling stat/access if you
would like.
--
Yasuo Ohgaki
Ilia A. wrote:
> The code appears to be working fine, on my system it returns
> bool(false)
> bool(false)
> bool(false)
> bool(false)
>
> and without the chmod line.
>
> bool(false)
> bool(true)
> bool(false)
> bool(false)
>
> Seems like perfectly valid behaviour to me, unlink() successfuly removed the
> file and from the looks of it cleared PHP's stat cache of the removed file. I
> fail to see why you are advocating that PHP should return TRUE for
> is_readable() of a file that is no longer on the file sytem.
>
> Ilia
>
> On September 24, 2002 08:22 pm, Yasuo Ohgaki wrote:
>
>>It seems stat cache is broken.
>>
>>I've tried 4.0.4pl1 and 4.3.0-dev, functions that
>>should use stat cache do no use cache, but it just
>>call stat or access as requested.
>>
>><?php
>>$filename = 'test_file';
>>
>>// make sure file does not exist
>>unlink($filename);
>>var_dump(is_readable($filename));
>>
>>// create file
>>touch($filename);
>>chmod($filename, 0);
>>var_dump(is_readable($filename));
>>
>>// remove file
>>unlink($filename); // chmod does not make difference
>>var_dump(is_readable($filename)); // This should use stat cache return
>>TRUE, isn't?
>>
>>// clear cache and test again
>>clearstatcache($filename);
>>var_dump(is_readable($filename));
>>
>>?>
>>
>>we have 2 choices.
>>
>>1) Fix stat cache
>>2) Change documentation
>>http://jp.php.net/manual/en/function.clearstatcache.php
>>
>>Fixing this will break many scripts, probably.
>>Just point it out the problem I noticed, since Wez is
>>going to rewrite stat related code soon(?) IIRC.
>
>
>
>