php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40831 cURL extension doesnt clear buffer for reused handle
Submitted: 2007-03-15 23:00 UTC Modified: 2007-03-15 23:19 UTC
From: eion at bigfoot dot com Assigned:
Status: Closed Package: cURL related
PHP Version: 4.4.6 OS: Gentoo Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eion at bigfoot dot com
New email:
PHP Version: OS:

 

 [2007-03-15 23:00 UTC] eion at bigfoot dot com
Description:
------------
Reusing a cURL request while using CURLOPT_RETURNTRANSFER=true causes the result of the first curl_exec() to still be in the body of the second curl_exec().  Possibly, buffer isnt being cleared.

I cant explain it properly, but the example code below should be able to.

This only happens on 4.4.6, and not on 4.4.4

Workaround is to use ob_start(); curl_exec($ch); $data=ob_get_clean();

Reproduce code:
---------------
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);


curl_setopt($ch, CURLOPT_URL, 'www.myjobspace.co.nz');
$data1 = curl_exec($ch);

curl_setopt($ch, CURLOPT_URL, 'www.myjobspace.co.nz/search');
$data2 = curl_exec($ch);


if (strpos($data2, $data1)===0)
{
	echo 'cURL Buffer is NOT being cleared';
} else {
	echo 'Everything ok';
}

Expected result:
----------------
Everything ok

Actual result:
--------------
cURL Buffer is NOT being cleared

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-15 23:19 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 21:01:35 2024 UTC