note 69931 added to function.gzread

From: Date: Wed, 27 Sep 2006 07:33:59 +0000
Subject: note 69931 added to function.gzread
Groups: php.notes 
Request: Send a blank email to php-notes+get-117707@lists.php.net to get a copy of this message
Be aware that gzread's second parameter - length reffers to the file's uncompressed size, therefore using this code: <?php $file_name = "/usr/local/something.txt.gz"; if($file_handle = gzopen($file_name, "r")) { $contents = gzread($file_handle, filesize($file_name)); gzclose($file_name); } ?> will probably truncate the content of the file as filesize checks for the file's compressed size. So either use the actual uncompressed size, if you know it, or use an aribtrary big enough length, as gzreading will stop at the end of the file anyway. ---- Server IP: 212.199.163.191 Probable Submitter: 62.219.237.90 ---- Manual Page -- http://www.php.net/manual/en/function.gzread.php Edit -- https://master.php.net/note/edit/69931 Del: integrated -- https://master.php.net/note/delete/69931/integrated Del: useless -- https://master.php.net/note/delete/69931/useless Del: bad code -- https://master.php.net/note/delete/69931/bad+code Del: spam -- https://master.php.net/note/delete/69931/spam Del: non-english -- https://master.php.net/note/delete/69931/non-english Del: in docs -- https://master.php.net/note/delete/69931/in+docs Del: other reasons-- https://master.php.net/note/delete/69931 Reject -- https://master.php.net/note/reject/69931 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117707) next »