php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21654 BINARIES DOWNLOADED CORRUPTION
Submitted: 2003-01-15 04:33 UTC Modified: 2003-01-15 05:13 UTC
From: patrick dot audemard at free dot fr Assigned:
Status: Not a bug Package: cURL related
PHP Version: 4CVS-2003-01-15 (stable) OS: WINDOWS 2000 SP3
Private report: No CVE-ID: None
 [2003-01-15 04:33 UTC] patrick dot audemard at free dot fr
WEB Server : Apache 2.0.42 with SSL enabled
PHP 4.3.1 CVS 2003-01-15-01-30
WINDOWS 2000 SP3
Browser IE6SP1

Script :

$ch = curl_init();
curl_setopt ($ch,CURLOPT_URL,$sitedownload.$_POST'fichier']);
curl_setopt ($ch, CURLOPT_HEADER,0);
curl_setopt ($ch,CURLOPT_PROXY,$proxy);
$fichiersigs = fopen ($_POST['fichier'], "w");
curl_setopt ($ch,CURLOPT_FILE,$fichiersigs);
$test = curl_exec ($ch);
curl_close ($ch);

If you configured PHP with Apache Module (php4apache2.dll) a binary downloaded file (tested ZIP File) is corrupted. It seemed to convert LF to CRLF but I'm not sure.

I tried without success :
curl_setopt ($ch,CURLOPT_CRLF,0);

If you configured PHP CGI, it works fine (I tested MD5).

I tested version 4.3.1 CVS 2003-01-14-01-30 and CVS 2003-01-15-01-30. I think it's easy to reproduce.

Yours sincerely,

Patrick AUDEMARD

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-15 05:13 UTC] moriyoshi@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

When using PHP on Windows platform it\'s generally necessary to specify binary mode at fopen() parameter in order to write out non-text data. But actually the data are always written as binary on CGI or CLI version of PHP binary unless you specify text mode that is represented as \"t\". This is a known exception.


 [2003-01-15 07:20 UTC] patrick dot audemard at free dot fr
I tested and it worked.
Sorry, I checked but I forgot the "wb" in the fopen()...

Yours sincerely,

Patrick AUDEMARD
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 13:01:26 2024 UTC