#31575 [NEW]: fpassthru, binary mode
| From: | kingoleg at mail dot ru | Date: | Sun, 16 Jan 2005 17:56:55 +0000 |
| Subject: | #31575 [NEW]: fpassthru, binary mode | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-72262@lists.php.net to get a copy of this message | ||
From: kingoleg at mail dot ru
Operating system: Linux version 2.4.20-8,Red Hat
PHP version: 4.3.10
PHP Bug Type: Filesystem function related
Bug description: fpassthru, binary mode
Description:
------------
It seems, that fpassthru() is not binary safe
Reproduce code:
---------------
First 8 bytes of file (PNG image) on disk:
"89 50 4E 47 0D 0A 1A 0A"
<?php
//...
$f = @fopen( $filepath, "rb" );
@fpassthru ($f);
//...die();
?>
Expected result:
----------------
First 8 bytes of saved file via browser:
"89 50 4E 47 0D 0A 1A 0A"
Actual result:
--------------
First 8 bytes of saved file via browser:
"0A 89 50 4E 47 0A 1A 0A"
PS. Other bytes of files are equal.
--
Edit bug report at http://bugs.php.net/?id=31575&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31575&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31575&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31575&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31575&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31575&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31575&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31575&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31575&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31575&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31575&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31575&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31575&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31575&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31575&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31575&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31575&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31575&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31575&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31575&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31575&r=mysqlcfg