#48208 [NEW]: curl_copy_handle() loses CURLOPT_POSTFIELDS option after original is closed
| From: | rick at meritos dot nl | Date: | Sat, 09 May 2009 14:10:52 +0000 |
| Subject: | #48208 [NEW]: curl_copy_handle() loses CURLOPT_POSTFIELDS option after original is closed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-137037@lists.php.net to get a copy of this message | ||
From: rick at meritos dot nl
Operating system: Linux
PHP version: 5.3.0RC2
PHP Bug Type: cURL related
Bug description: curl_copy_handle() loses CURLOPT_POSTFIELDS option after original is closed
Description:
------------
After a curl handle is copied and the original closed with curl_close(),
the copy no longer seems to contain the CURLOPT_POSTFIELDS option.
If the original is excecuted first, things get even stranger, the return
value of curl_exec() on the copy seems to be borked.
Reproduce code:
---------------
$url = "http://www.example.com/get.php?test=getpost";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
"Hello=World&Foo=Bar&Person=John%20Doe");
curl_setopt($ch, CURLOPT_URL, $url);
$copy = curl_copy_handle($ch);
curl_close($ch);
$curl_content = curl_exec($copy);
var_dump( $curl_content );
Expected result:
----------------
string(163) "array(1) {
["test"]=>
string(7) "getpost"
}
array(3) {
["Hello"]=>
string(5) "World"
["Foo"]=>
string(3) "Bar"
["Person"]=>
string(8) "John Doe"
}
Actual result:
--------------
string(61) "array(1) {
["test"]=>
string(7) "getpost"
}
array(0) {
}
"
Note: comment out the curl_close($ch); , and it will return the expected
result.
--
Edit bug report at http://bugs.php.net/?id=48208&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48208&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48208&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48208&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=48208&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48208&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=48208&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=48208&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=48208&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=48208&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=48208&r=support
Expected behavior: http://bugs.php.net/fix.php?id=48208&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=48208&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=48208&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=48208&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48208&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48208&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=48208&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=48208&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=48208&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=48208&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=48208&r=mysqlcfg