note 87531 added to function.readfile

From: Date: Tue, 09 Dec 2008 11:32:21 +0000
Subject: note 87531 added to function.readfile
Groups: php.notes 
Request: Send a blank email to php-notes+get-147947@lists.php.net to get a copy of this message
I think that there are some fencepost (off by one) errors in the smartReadFile from gaosipov: $end must be one less than the file size, since it is the absolute position of the last byte in the file, and bytes are counted starting from 0: $end=$size-1; if($begin>0||$end<($size-1)) while(!feof($fm)&&$cur<=$end&&(connection_status()==0)) { print fread($fm,min(1024*16,($end+1)-$cur)); ---- Server IP: 130.206.1.5 Probable Submitter: 217.127.125.134 ---- Manual Page -- http://www.php.net/manual/en/function.readfile.php Edit -- https://master.php.net/note/edit/87531 Del: integrated -- https://master.php.net/note/delete/87531/integrated Del: useless -- https://master.php.net/note/delete/87531/useless Del: bad code -- https://master.php.net/note/delete/87531/bad+code Del: spam -- https://master.php.net/note/delete/87531/spam Del: non-english -- https://master.php.net/note/delete/87531/non-english Del: in docs -- https://master.php.net/note/delete/87531/in+docs Del: other reasons-- https://master.php.net/note/delete/87531 Reject -- https://master.php.net/note/reject/87531 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#147947) next »