|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38637 curl_exec return true with curl_copy_handle
Submitted: 2006-08-29 01:06 UTC Modified: 2006-08-29 22:27 UTC
From: waax at yahoo dot com Assigned: iliaa (profile)
Status: Closed Package: cURL related
PHP Version: 5.1.5 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2006-08-29 01:06 UTC] waax at yahoo dot com
My script create a default curl handle with some default option along CURLOPT_RETURNTRANSFER that is used as a "template". This default curl handle is then copied with curl_copy_handle for all connections i need to create.

I expected each call of curl_exec to return the content downloaded. 

Instead, each call return bool(true).

libcurl/7.14.0 OpenSSL/0.9.8a zlib/1.2.3

Reproduce code:
// Creating default Curl Handler
$ch_default = curl_init();

// Setting some options
curl_setopt($ch_default, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch_default, CURLOPT_AUTOREFERER, true);
curl_setopt($ch_default, CURLOPT_RETURNTRANSFER, true);

$ch2 = curl_copy_handle($ch_default);
// Uncomment to see the difference
// $ch2 = curl_init();
// curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch2, CURLOPT_URL, "");

$res = curl_exec($ch2);


Expected result:
string(10074) "<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="PICS-Label" content='(PICS-1.1 "" l r (cz 1 lz 1 nz 1 oz 1 vz 1) gen true for "" r (cz1 lz 1 nz 1 oz 1 vz 1) "" l r (n 0 s 0 v 0 l0) gen true for "" r (n 0 s 0 v 0 l 0))'>

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-29 08:29 UTC]
Ilia, please take a look at it.
This patch fixes it:
But the problem is that it re-sets options that could be changed by the user, so we something smarter here..
So, the idea is that currently all buffers point to the original handle, even though we're executing the copy.
 [2006-08-29 17:11 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2006-08-29 22:27 UTC] waax at yahoo dot com
Thanks to you!
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 00:01:29 2024 UTC