|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-13 10:44 UTC] cataphract@php.net
-Status: Open
+Status: Feedback
[2011-04-13 10:44 UTC] cataphract@php.net
[2011-04-13 15:14 UTC] gabriel at justbull dot com
[2011-04-13 15:14 UTC] gabriel at justbull dot com
-Status: Feedback
+Status: Closed
[2011-04-13 15:14 UTC] gabriel at justbull dot com
[2011-04-13 15:16 UTC] pajoye@php.net
-Status: Closed
+Status: Bogus
[2011-04-13 15:16 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 16:00:01 2025 UTC |
Description: ------------ With some PDF files (not all), the filesize function report a file size that is not representative of the size of the file produced by readfile. The filesize gives the same filesize as the original file. But the readfile doesn't give the exact same content as the original file, making it slightly bigger. This results in some part of the file being cut if you include the filesize in the header. I can reproduce this bug on 2 servers, Test script: --------------- header('Content-Type: application/pdf'); header("Content-Length: ".filesize($file)); readfile($file); exit(); // THIS CODE PRODUCE THE SAME PROBLEM ob_start(); readfile($file); $output = ob_get_clean(); header('Content-Type: application/pdf'); header("Content-Length: ".strlen($output)); echo $output; exit(); Expected result: ---------------- Expect the filesize to return the right filesize. Or the readfile to output the exactly same content as the original file. Actual result: -------------- The filesize function report a file size that is not representative of the size of the file produced by readfile.