Bug #54518 [NEW]: filesize and reafile incosistencies with pdf file

From: Date: Tue, 12 Apr 2011 19:55:17 +0000
Subject: Bug #54518 [NEW]: filesize and reafile incosistencies with pdf file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160136@lists.php.net to get a copy of this message
From: Operating system: Centos 5.5 PHP version: 5.3.6 Package: Filesystem function related Bug Type: Bug Bug description:filesize and reafile incosistencies with pdf file 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. -- Edit bug report at http://bugs.php.net/bug.php?id=54518&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54518&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54518&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54518&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54518&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54518&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54518&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54518&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54518&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54518&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54518&r=support Expected behavior: http://bugs.php.net/fix.php?id=54518&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54518&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54518&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54518&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54518&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54518&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54518&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54518&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54518&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54518&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54518&r=mysqlcfg

« previous php.bugs (#160136) next »