xref: /PHP-8.4/ext/curl/tests/bug77946.phpt (revision 25c09939)
1--TEST--
2Bug #77946 (Errored cURL resources returned by curl_multi_info_read() must be compatible with curl_errno() and curl_error())
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7$urls = array(
8   'unknown://scheme.tld',
9);
10
11$mh = curl_multi_init();
12
13foreach ($urls as $i => $url) {
14    $conn[$i] = curl_init($url);
15    curl_multi_add_handle($mh, $conn[$i]);
16}
17
18do {
19    $status = curl_multi_exec($mh, $active);
20    $info = curl_multi_info_read($mh);
21    if (false !== $info) {
22        var_dump($info['result']);
23        var_dump(curl_errno($info['handle']));
24        var_dump(curl_error($info['handle']));
25    }
26} while ($status === CURLM_CALL_MULTI_PERFORM || $active);
27
28foreach ($urls as $i => $url) {
29    curl_close($conn[$i]);
30}
31
32curl_multi_close($mh);
33?>
34--EXPECTF--
35int(1)
36int(1)
37string(%d) "Protocol %Sunknown%S %rnot supported( or disabled in libcurl)?%r"
38