|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-27 21:12 UTC] tony2001@php.net
[2006-06-27 21:37 UTC] sviver at vnet dot hu
[2006-06-27 21:57 UTC] tony2001@php.net
[2006-06-27 22:34 UTC] sviver at vnet dot hu
[2006-06-27 22:44 UTC] tony2001@php.net
[2006-06-30 16:25 UTC] sviver at vnet dot hu
[2006-06-30 16:55 UTC] sviver at vnet dot hu
[2006-06-30 22:03 UTC] tony2001@php.net
[2006-07-08 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |
Description: ------------ I open a file of about 600kb, then loop over it with feof and fread, and echo the read data to the output. In a previous php version (>5, <5.1.4) it returned random characters, but the file size was correct. So I upgraded to 5.1.4 to see whether the problem is still there. With the new version there are no random characters, but the result is much smaller than the original file. Sometimes it's 73728 (=72*1024) bytes, somtimes 24576 (=24*1024), sometimes 98304 (also divisible), sometimes 81920 (also divisible). Etc. The previous version also started producing strange output after reading several block correctly - the new version simply stops reading. With the previous version the problem disappered if I set the block size to 1*1028. With the new version it persists. There is no error message at the end of the file. Reproduce code: --------------- <?php $filename='../data/temp/temp_output/5741921624893711'; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="test.file"'); $packet = 4*1024; $buff = ''; $F = fopen($filename, 'rb'); while (!feof($F)) { $buff = fread($F, $packet); echo $buff; } fclose($F); ?> Expected result: ---------------- The complete file as a download. Actual result: -------------- Part of the file.