Bug #54518 [Csd->Bgs]: filesize and reafile incosistencies with pdf file
| From: | pajoye@php.net | Date: | Wed, 13 Apr 2011 13:16:56 +0000 |
| Subject: | Bug #54518 [Csd->Bgs]: filesize and reafile incosistencies with pdf file | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160149@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54518&edit=1
ID: 54518
Updated by: pajoye@php.net
Reported by: gabriel at justbull dot com
Summary: filesize and reafile incosistencies with pdf file
-Status: Closed
+Status: Bogus
Type: Bug
Package: Filesystem function related
Operating System: Centos 5.5
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Not a php bug > bogus.
Previous Comments:
------------------------------------------------------------------------
[2011-04-13 15:14:51] gabriel at justbull dot com
Closing
------------------------------------------------------------------------
[2011-04-13 15:14:13] gabriel at justbull dot com
Ok, an included file had line returns after the ?>. I guess what threw
me in the
wrong direction is that it was still working fine with some PDFs.
------------------------------------------------------------------------
[2011-04-13 10:44:50] cataphract@php.net
Almost certainly bogus, but in any case, what is this extra data that's
causing the discrepancy? What's its place in the output stream?
Most likely there's whitespace or a BOM mark in the script (or an
included script).
------------------------------------------------------------------------
[2011-04-12 21:55:16] gabriel at justbull dot com
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 this bug report at http://bugs.php.net/bug.php?id=54518&edit=1