ID: 37939 Updated by: [EMAIL PROTECTED] Reported By: sviver at vnet dot hu -Status: Open +Status: Feedback Bug Type: Filesystem function related Operating System: Windows XP prof. PHP Version: 5.1.4 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.2-win32-latest.zip Honestly saying, I don't understand why you're not using readfile(), as it does exactly what you're doing manually. Previous Comments: ------------------------------------------------------------------------ [2006-06-27 21:05:51] sviver at vnet dot hu 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37939&edit=1