#48304 [Com]: curl_errno return 0 on error
ID: 48304
Comment by: knockk at mail dot ru
Reported By: dypa at bk dot ru
Status: Open
Bug Type: cURL related
Operating System: linux
PHP Version: 5.2CVS-2009-05-16 (snap)
New Comment:
same problem on windows xp php 5.2.9-1
Previous Comments:
------------------------------------------------------------------------
[2009-05-16 17:07:30] dypa at bk dot ru
Description:
------------
when i use curl_multi curl_errno returns 0 on errors
see:
user@localhost:/$php code.php
this bug related to: http://bugs.php.net/bug.php?id=33570
Reproduce code:
---------------
<?php
// create both cURL resources
$ch1 = curl_init();
$ch2 = curl_init();
// set URL and other appropriate options
curl_setopt($ch1, CURLOPT_URL, "http://404.php.net");
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch2, CURLOPT_HEADER, 0);
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
//create the multiple cURL handle
$mh = curl_multi_init();
//add the two handles
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
$running=null;
//execute the handles
do {
curl_multi_exec($mh,$running);
} while ($running > 0);
var_dump($ch1);
var_dump($ch2);
var_dump(curl_errno($ch1));
var_dump(curl_errno($ch2));
var_dump(curl_error($ch1));
var_dump(curl_error($ch2));
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);
Expected result:
----------------
resource(4) of type (curl)
resource(5) of type (curl)
int(6) //CURLE_COULDNT_RESOLVE_HOST (6)
int(0)
string(35) "Couldn't resolve host '404.php.net'"
string(0) ""
Actual result:
--------------
resource(4) of type (curl)
resource(5) of type (curl)
int(0)
int(0)
string(35) "Couldn't resolve host '404.php.net'"
string(0) ""
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48304&edit=1
Thread (6 messages)