php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77946 Bad cURL resources returned by curl_multi_info_read()
Submitted: 2019-04-27 12:12 UTC Modified: -
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: phansys at gmail dot com Assigned:
Status: Closed Package: cURL related
PHP Version: 7.3.4 OS:
Private report: No CVE-ID: None
 [2019-04-27 12:12 UTC] phansys at gmail dot com
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


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-04-27 13:19 UTC]
The following pull request has been associated:

Patch Name: [cURL] [bug#77946] Add test for `curl_multi_info_read()`
On GitHub:  https://github.com/php/php-src/pull/4075
Patch:      https://github.com/php/php-src/pull/4075.patch
 [2019-04-29 20:56 UTC] phansys at gmail dot com
This issue seems to be a duplicate of https://bugs.php.net/bug.php?id=60660, which is currently in "Bogus" status.
 [2019-06-05 06:52 UTC] toni dot ertl at check24 dot de
happens also with version 7.2.19
 [2019-07-18 12:42 UTC] nikic@php.net
Automatic comment on behalf of valga@abyrga.ru
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c8c183eb62b666b5e9c92ca2cbf13f5464ae3aa9
Log: Fixed bug #77946
 [2019-07-18 12:42 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 13:01:27 2024 UTC