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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC