#48208 [Opn->Fbk]: curl_copy_handle() loses CURLOPT_POSTFIELDS option after original is closed
| From: | jani@php.net | Date: | Sat, 09 May 2009 19:11:15 +0000 |
| Subject: | #48208 [Opn->Fbk]: curl_copy_handle() loses CURLOPT_POSTFIELDS option after original is closed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137044@lists.php.net to get a copy of this message | ||
ID: 48208
Updated by: jani@php.net
Reported By: rick at meritos dot nl
-Status: Open
+Status: Feedback
Bug Type: cURL related
Operating System: Linux
PHP Version: 5.3.0RC2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Previous Comments:
------------------------------------------------------------------------
[2009-05-09 14:10:52] rick at meritos dot nl
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 this bug report at http://bugs.php.net/?id=48208&edit=1