note 32695 added to function.fwrite

From: Date: Wed, 04 Jun 2003 16:35:09 +0000
Subject: note 32695 added to function.fwrite
Groups: php.notes 
Request: Send a blank email to php-notes+get-49729@lists.php.net to get a copy of this message
Use caution when using: $content = fread($fh, filesize($fh)) or die "Error Reading"; This will cause an error if the file you are reading is zero length. Intead use: if ( false === fread($fh, filesize($fh)) ) die "Error Reading"; Thus it will be successful on reading zero bytes but detect and error returned as FALSE. ---- Manual Page -- http://www.php.net/manual/en/function.fwrite.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32695 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32695&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32695&report=yes

« previous php.notes (#49729) next »