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 #176029 is a reply to message #176028] Thu, 17 November 2011 17:21 Go to previous messageGo to previous message
Simon is currently offline  Simon
Messages: 29
Registered: February 2011
Karma:
Junior Member
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.

>
> 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.

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: Fri Nov 29 01:38:29 GMT 2024

Total time taken to generate the page: 0.16963 seconds