From: christian at vaneeden dot ca
Operating system: Redhat AS 4
PHP version: 5.2.4
PHP Bug Type: Streams related
Bug description: file_get_content reading binary data incorrectly
Description:
------------
When you read in a binary file with file_get_contents() and try to output
it, it comes out garbled.
Note: as a workaround use readfile()
Reproduce code:
---------------
$docFile = file_get_contents( 'word.doc' );
header('Content-type: application/msword; charset: UTF-8');
header('Content-Disposition: attachment; filename="word.doc'"');
header('Cache-Control: must-revalidate');
print $docFile;
Expected result:
----------------
A proper word document.
Actual result:
--------------
Garbled binary text.
--
Edit bug report at http://bugs.php.net/?id=42661&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42661&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42661&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42661&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42661&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42661&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42661&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42661&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42661&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42661&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42661&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42661&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42661&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42661&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42661&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42661&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42661&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42661&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42661&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42661&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42661&r=mysqlcfg