ID:               48208
 Updated by:       j...@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

Reply via email to