cURL extension doesnt clear buffer for reused handle
| 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 | ||
[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 commits
[2007-03-15 23:19 UTC] tony2001@php.net