#31575 [Fbk->Opn]: fpassthru, binary mode
| From: | kingoleg at mail dot ru | Date: | Sun, 16 Jan 2005 19:10:46 +0000 |
| Subject: | #31575 [Fbk->Opn]: fpassthru, binary mode | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72264@lists.php.net to get a copy of this message | ||
ID: 31575
User updated by: kingoleg at mail dot ru
Reported By: kingoleg at mail dot ru
-Status: Feedback
+Status: Open
Bug Type: Filesystem function related
Operating System: Linux version 2.4.20-8,Red Hat
PHP Version: 4.3.10
New Comment:
No.
Right before @fpassthru ($f); headers sends. So, it can not be a new
line before fpassthru, otherwise header(""); write error message. But
there is no error messages in error_log, in browset output. And headers
are right.
Previous Comments:
------------------------------------------------------------------------
[2005-01-16 19:32:28] wez@php.net
You've probably got a newline at the top of your script, before the
<?php, or a trailing newline from some include or auto-prepend file.
------------------------------------------------------------------------
[2005-01-16 18:56:55] kingoleg at mail dot ru
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 this bug report at http://bugs.php.net/?id=31575&edit=1