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