Bug #78404 [Fbk->Opn]: Curl Multi Handle: curl_error($ch) returns no error string

From: Date: Mon, 12 Aug 2019 10:49:56 +0000
Subject: Bug #78404 [Fbk->Opn]: Curl Multi Handle: curl_error($ch) returns no error string
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222190@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78404&edit=1

 ID:                 78404
 User updated by:    sa dot su dot technic at gmail dot com
 Reported by:        sa dot su dot technic at gmail dot com
 Summary:            Curl Multi Handle: curl_error($ch) returns no error
                     string
-Status:             Feedback
+Status:             Open
 Type:               Bug
 Package:            cURL related
 Operating System:   Debian 8
 PHP Version:        7.3.8
 Block user comment: N
 Private report:     N

 New Comment:

I use "curl 7.38.0 (x86_64-pc-linux-gnu) libcurl/7.38.0 OpenSSL/1.0.1t zlib/1.2.8 libidn/1.29
libssh2/1.4.3 librtmp/2.3"

There is no change to the version I used with php 7.2 and there everything works as expected.


Previous Comments:
------------------------------------------------------------------------
[2019-08-12 09:37:31] requinix@php.net

What version of cURL are you using? Because this looks like an upstream matter.

Between 7.58 and 7.64 (the two versions I have on hand) two things changed:
1. Errors during multi operations "bubble up" into the original handles
2. Port number error message was removed
https://github.com/curl/curl/commit/46e1640#diff-8fb104c402dc51bdffef05a372f32aa2L3447

I modified your example to set CURLOPT_VERBOSE and mark the two messages with 1/2. On 7.64 on
Windows I get

* Expire in 0 ms for 6 (transfer 0x20d4a2f41c0)
* Expire in 0 ms for 6 (transfer 0x20d4a2f9980)
* Protocol "foobar" not supported or disabled in libcurl
* Closing connection -1
* Closing connection -1
1: Protocol "foobar" not supported or disabled in libcurl
2:

With 7.58 on Ubuntu 18.04 I get

* Protocol "Foobar" not supported or disabled in libcurl
* Closing connection -1
* Port number out of range
* Closing connection -1
1:
2:

------------------------------------------------------------------------
[2019-08-12 08:52:09] sa dot su dot technic at gmail dot com

Description:
------------
As always in previous php versions there is no returned error string by calling
"curl_error($foo)" (e.g. "Port number out of range") when executing curl multi
handle.

Test script:
---------------
$ch1 = curl_init();
$ch2 = curl_init();
curl_setopt($ch1, CURLOPT_URL, "Foobar://127.0.0.1:777/foobar");
curl_setopt($ch2, CURLOPT_URL, "http://127.0.0.1:999999999/foobar");

$mh = curl_multi_init();
curl_multi_add_handle($mh,$ch1);
curl_multi_add_handle($mh,$ch2);
do {
    $status = curl_multi_exec($mh, $active);
    if ($active) {
        curl_multi_select($mh);
    }
} while ($active && $status == CURLM_OK);

echo curl_error($ch1) . PHP_EOL;
echo curl_error($ch2);

curl_multi_remove_handle($mh, $ch1);
curl_multi_remove_handle($mh, $ch2);
curl_multi_close($mh);

Expected result:
----------------
Output of "curl_error($ch1)":
Protocol "Foobar" not supported or disabled in libcurl

Output of "curl_error($ch2)":
Port number out of range



Actual result:
--------------
Output of "curl_error($ch1)":
Empty string

Output of "curl_error($ch2)":
Empty string


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78404&edit=1


Thread (15 messages)

« previous php.bugs (#222190) next »