From:             eion at bigfoot dot com
Operating system: Gentoo Linux
PHP version:      4.4.6
PHP Bug Type:     cURL related
Bug description:  cURL extension doesnt clear buffer for reused handle

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 bug report at http://bugs.php.net/?id=40831&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40831&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40831&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40831&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40831&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40831&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40831&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40831&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40831&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40831&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40831&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40831&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40831&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40831&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40831&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40831&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40831&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40831&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40831&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40831&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40831&r=mysqlcfg

Reply via email to