FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Prevent unlink(...) warning
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Prevent unlink(...) warning [message #176031 is a reply to message #176029] Thu, 17 November 2011 18:29 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
Simon wrote:
> On 2011/11/17 05:18 PM, The Natural Philosopher wrote:
>> Simon wrote:
>>> Hi,
>>>
>>> I am having some race condition issues on my server when trying to
>>> delete a file.
>>>
>>
>> what makes you think its a race condition?
>
> A guess really,
>
> If I do:
> ...
> if (file_exists($filename))
> {
>
> and followed by
> ...
> @unlink($filename);
> }
>
> And that gives me a
>
> unlink(/home/xxx/public_html/temp/yyy.zz) [function.unlink]: No such
> file or directory
>
> The something between file_exists(...) and @unlink(...) must have
> removed the file.
> Either that or one of the two functions is not working as expected.
>

Hmm..what else CAN be deleting that file (unless you are doing the same
thing twice)?

>>
>> Why do you care about the stat cache?
>>
>
> As per the doc, http://php.net/manual/en/function.clearstatcache.php, to
> make sure that file_exists($filename) does return a cached value.
>
>>>
>>> How can I prevent the warning?
>>>
>> Why prevent it at all?
>>
>> As long as the file is not there when you are finished - why not just
>> unlink it anyway?
>>
>
> Because the warnings fill my logs and I aim for no warnings at all.
>

Well, that's reasonable..;-)
> Simon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Embedding HTML Within a PHP Statement
Next Topic: Re: comp.lang.php forum
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 17:14:47 GMT 2024

Total time taken to generate the page: 0.06220 seconds