RE: asking comment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> JW> If want to create a unique filename, and are using PHP4.3.2 or 
> JW> better, use fopen() with the 'x' or 'x+' mode, rather than 
> JW> file_exists().
> 
> If you're happy with your scripts generating E_WARNING's all 
> over the place then yes. Personally, I'm not.

Use @ to surpress them.

You cannot guarentee the filename you think doesn't exist with the file_exists() doesn't exist when you eventually fopen() it,
otherwise. This problem falls into a category called "Race conditions". http://en.wikipedia.org/wiki/Race_condition and
http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/avoid-race.html.

Jared

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux