Bug #60660 [NEW]: curl_errno returns 0 instead of 6
| From: | bart at ajaxer dot net | Date: | Wed, 04 Jan 2012 21:16:14 +0000 |
| Subject: | Bug #60660 [NEW]: curl_errno returns 0 instead of 6 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-166221@lists.php.net to get a copy of this message | ||
From:
Operating system: Win XP
PHP version: 5.3.8
Package: cURL related
Bug Type: Bug
Bug description:curl_errno returns 0 instead of 6
Description:
------------
This issue concerns only multi curl.
Single handle curl works correct and returns error no. 6 when host is not
resolved.
In the same situation multi curl returns 0 with curl_errno function despite
the fact that curl_error returns error message.
See codes of 2 examples below
Test script:
---------------
<?
// Create a curl handle to a non-existing location
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://osms.pl');
// Execute
curl_exec($ch);
// Check if any error occured
if(curl_errno($ch))
{
echo 'Curl error: ' . curl_error($ch) . ' - ' .curl_errno($ch);
}
// Close handle
curl_close($ch);
?>
-------------------------------------------------------------------------------
<?php
// create both cURL resources
$ch1 = curl_init();
// set URL
curl_setopt($ch1, CURLOPT_URL, "http://404.php.net/");
//create the multiple cURL handle
$mh = curl_multi_init();
curl_multi_add_handle($mh,$ch1);
$active = null;
//execute the handles
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) != -1) {
do {
$mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
echo 'Curl error: ' . curl_error($ch1) . ' - ' .curl_errno($ch1);
//close the handles
curl_multi_remove_handle($mh, $ch1);
curl_multi_close($mh);
?>
Expected result:
----------------
in first example:
Curl error: Could not resolve host: osms.pl; Host not found - 6
in second:
Curl error: Could not resolve host: (nil); Host not found - 0
--
Edit bug report at https://bugs.php.net/bug.php?id=60660&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60660&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60660&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60660&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=60660&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60660&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=60660&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=60660&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=60660&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=60660&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=60660&r=support
Expected behavior: https://bugs.php.net/fix.php?id=60660&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=60660&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=60660&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=60660&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60660&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60660&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=60660&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=60660&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=60660&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=60660&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=60660&r=mysqlcfg