php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29099 file_get_contents returns corrupted results with remote files
Submitted: 2004-07-11 20:48 UTC Modified: 2004-07-13 01:01 UTC
From: mj@php.net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 5CVS-2004-07-11 (dev) OS: Linux
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: mj@php.net
New email:
PHP Version: OS:

 

 [2004-07-11 20:48 UTC] mj@php.net
Description:
------------
When using file_get_contents() on remote files, the result differs from the (correct) result using the Curl functions.

Reproduce code:
---------------
$ch = curl_init("http://www.php.net/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$str1 = curl_exec($ch);
curl_close($ch);

$str2 = file_get_contents("http://www.php.net/");

if ($str1 != $str2) {
    echo "Both results differ.\n";
} else {
    echo "Both results are the same.\n";
}


Expected result:
----------------
Output "Both results are the same."

Actual result:
--------------
Output "Both results differ."

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-11 23:19 UTC] curt@php.net
it seems this broke between June 18th and July 8, possibly related to php_stream_copy_to_mem().

 [2004-07-13 01:01 UTC] curt@php.net
Fixed in cvs
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC