note 57795 added to function.fwrite

From: Date: Fri, 14 Oct 2005 12:01:15 +0000
Subject: note 57795 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-97014@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57795 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57795&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57795&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97014) next »