note 58656 rejected from function.fopen by betz

From: Date: Sat, 12 Nov 2005 11:07:50 +0000
Subject: note 58656 rejected from function.fopen by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-98470@lists.php.net to get a copy of this message
Note Submitter: Mario at tweakBSD dot org ---- Just to mention today I read in a book I won't say here, it is absolutly essential to call is_readable or is_writeable first when fopen'ing files to pre-react on errors. I think this approach is quite good but its not safe in my mind to say that a file is_readable or is_writable even when they return true, there can be a short period between the calls where something can happen so I think it is better to do it this way <?PHP $path = "./bla.txt"; if( ($fp = fopen($path, "mode") != false) { // further file operations } ?> to be on the safe side. Or can someone tell me that is_readable or is_writable guarantees that fopen with appropriate mode will return true??

« previous php.notes (#98470) next »