Bug #77946 [NEW]: Bad cURL resources returned by curl_multi_info_read()
| From: | phansys at gmail dot com | Date: | Sat, 27 Apr 2019 12:12:28 +0000 |
| Subject: | Bug #77946 [NEW]: Bad cURL resources returned by curl_multi_info_read() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220624@lists.php.net to get a copy of this message | ||
From: phansys at gmail dot com
Operating system:
PHP version: 7.3.4
Package: cURL related
Bug Type: Bug
Bug description:Bad cURL resources returned by curl_multi_info_read()
Description:
------------
cURL resources returned by curl_multi_info_read() aren't usables with
curl_errno() or curl_errno(). When an error occurs with these resources,
the "handle" returned doesn't behave as a single handle.
I've created a draft PR with a test exposing the problem:
https://github.com/php/php-src/pull/4075
Test script:
---------------
$urls = array(
'http://nonexistent.tld',
);
$mh = curl_multi_init();
foreach ($urls as $i => $url) {
$conn[$i] = curl_init($url);
curl_multi_add_handle($mh, $conn[$i]);
}
do {
$status = curl_multi_exec($mh, $active);
$info = curl_multi_info_read($mh);
if (false !== $info) {
echo $info['result']."\n";
echo curl_errno($info['handle'])."\n";
echo curl_error($info['handle'])."\n";
}
} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
foreach ($urls as $i => $url) {
curl_close($conn[$i]);
}
curl_multi_close($mh);
Expected result:
----------------
6
6
Could not resolve host: nonexistent.tld
Actual result:
--------------
6
0
--
Edit bug report at https://bugs.php.net/bug.php?id=77946&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77946&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77946&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77946&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77946&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77946&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77946&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77946&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77946&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77946&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77946&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77946&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77946&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77946&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77946&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77946&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77946&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77946&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77946&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77946&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77946&r=mysqlcfg