note 57795 deleted from function.fwrite by bjori

From: Date: Wed, 22 Mar 2006 17:48:58 +0000
Subject: note 57795 deleted from function.fwrite by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106282@lists.php.net to get a copy of this message
Note Submitter: aaron-php at oakadaptive dot com ---- chill at cuna dot org wrote: > In PHP 4.3.7 fwrite returns 0 rather than false on > failure. This is true (under certain circumstances) in (at least) PHP 4 and 5. I filed it as a bug (see [1]) but it's the intended behavior -- writing less than the requested number of bytes is not considered an error. This means that you should only consider an fwrite successful if its return value is the same as the length of the string you passed to it. (fwrite fails in this particular way if the filesystem is full, or if the file was opened in read-only mode, and probably in yet other situations.) fwrite does return false (and trigger a warning) in certain cases; e.g., when it's passed an invalid file handle. [1] <http://bugs.php.net/bug.php?id=34860> -- Aaron

« previous php.notes (#106282) next »