note 87531 deleted from function.readfile by thiago
| From: | thiago@php.net | Date: | Wed, 28 Jan 2009 16:09:52 +0000 |
| Subject: | note 87531 deleted from function.readfile by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149891@lists.php.net to get a copy of this message | ||
Note Submitter: Jorge
----
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));