|
Posted by Jared Williams on 03/30/05 18:51
> 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
Navigation:
[Reply to this message]
|