php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69607 curl_multi_select returns -1 for error or non error condition.
Submitted: 2015-05-08 17:10 UTC Modified: 2016-07-27 02:27 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: daniel dot pitts at cbsinteractive dot com Assigned: pierrick (profile)
Status: Closed Package: cURL related
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: daniel dot pitts at cbsinteractive dot com
New email:
PHP Version: OS:

 

 [2015-05-08 17:10 UTC] daniel dot pitts at cbsinteractive dot com
Description:
------------
curl_multi_select returns -1 for error or non error condition.

If the underlying 'curl_multi_fdset' sets the max_fd to -1, curl_multi_select returns -1.  That isn't an error condition, but a 'please call curl_multi_perform soon' signal.  

If the underlying call to 'select' returns error (-1), then it is an error condition. Unfortunately there is no way from the PHP code to find out if select reported an error, or if the multi_fdset reported max_fd = -1.  

It would be useful if curl_multi_select at least set some value somewhere that would let us know that the select failed, preferably with info from errno.

  $result = curl_multi_select($cmh);
  if ($result === -1) {
     $err = curl_multi_select_last_error($cmh); // missing this function.
     if ($err) {
        throw new \Exception($err);
     }
  }




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-24 03:58 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2016-04-24 03:58 UTC] pierrick@php.net
I started a patch that implement two new functions :

curl_multi_errno and curl_multi_strerror.

In your case you'll have to do curl_multi_strerror(curl_multi_errno($cmh));
This patch should be committed in PHP7.1
 [2016-07-27 02:27 UTC] pierrick@php.net
-Status: Assigned +Status: Closed
 [2016-07-27 02:27 UTC] pierrick@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

New functions were added in PHP7.1 

https://wiki.php.net/rfc/new-curl-error-functions
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Mar 13 21:01:32 2025 UTC