#40831 [Opn->Csd]: cURL extension doesnt clear buffer for reused handle
ID: 40831
Updated by: tony2001@php.net
Reported By: eion at bigfoot dot com
-Status: Open
+Status: Closed
Bug Type: cURL related
Operating System: Gentoo Linux
PHP Version: 4.4.6
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-03-15 23:00:50] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40831&edit=1
Thread (2 messages)