php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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); }
fclose($fp);
$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 ovh.org), nothing changed.

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

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

--Jani

 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Oct 05 21:05:52 2022 UTC