|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11143 bad fread output
Submitted: 2001-05-27 15:14 UTC Modified: 2001-05-28 20:03 UTC
From: plastoc at ifrance dot com Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.5 OS: Windows98
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: plastoc at ifrance dot com
New email:
PHP Version: OS:


 [2001-05-27 15:14 UTC] plastoc at ifrance dot com
<? $fp = fopen("$url", "rb"); // read binary file
while (!feof($fp)) {
$img = fread($fp, 4096); }
$fp = fopen("$dest","w"); // save binary file
fputs($fp, "$img");
fclose($fp); ?>

Using Windows98 with EasyPHP 1.3, ALL characters ASCII(10) found in the file become ASCII(10) with a NEW LINE after !
But using another platform like unix (I tested the script at, nothing changed.

I tried with the "r" and the "rb" argument in fopen but it didn't work.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-28 20:03 UTC]
You need to open the destination file also in binary mode.

$fp=fopen("$dest", "wb");


PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 10:01:28 2024 UTC