#38637 [Csd]: curl_exec return true with curl_copy_handle
| From: | waax at yahoo dot com | Date: | Tue, 29 Aug 2006 22:27:36 +0000 |
| Subject: | #38637 [Csd]: curl_exec return true with curl_copy_handle | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101506@lists.php.net to get a copy of this message | ||
ID: 38637
User updated by: waax at yahoo dot com
Reported By: waax at yahoo dot com
Status: Closed
Bug Type: cURL related
Operating System: Windows XP SP2
PHP Version: 5.1.5
Assigned To: iliaa
New Comment:
Thanks to you!
Previous Comments:
------------------------------------------------------------------------
[2006-08-29 17:11:02] iliaa@php.net
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
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2006-08-29 08:29:24] tony2001@php.net
Ilia, please take a look at it.
This patch fixes it: http://tony2001.phpclub.net/dev/tmp/bug38637.diff
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 01:06:50] waax at yahoo dot com
Description:
------------
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:
---------------
<?php
// 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, "http://yahoo.com");
$res = curl_exec($ch2);
var_dump($res);
?>
Expected result:
----------------
string(10074) "<html><head>
<title>Yahoo!</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="PICS-Label" content='(PICS-1.1
"http://www.icra.org/ratingsv02.html" l r
(cz 1 lz 1 nz 1 oz 1 vz 1)
gen true for "http://www.yahoo.com" r (cz1 lz 1
nz 1 oz 1 vz 1)
"http://www.rsac.org/ratingsv01.html" l r
(n 0 s 0 v 0 l0) gen true for
"http://www.yahoo.com" r (n 0 s 0 v 0 l
0))'>
[TRUNCATED]
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38637&edit=1