Skip to content

we're (mostly) ignoring the return of curl_multi_exec() #5

@divinity76

Description

@divinity76

that's ok as long as it always returns CURLM_OK, which it is supposed to do, in lack of errors,

but per https://curl.haxx.se/libcurl/c/libcurl-errors.html it can also return other values, for example:

CURLM_OK (0)

Things are fine.

CURLM_OUT_OF_MEMORY (3)

You are doomed.

CURLM_UNKNOWN_OPTION (6)

curl_multi_setopt() with unsupported option (Added in 7.15.4)

CURLM_INTERNAL_ERROR (4)

This can only be returned if libcurl bugs. Please report it to us!

i suggest that instead of our current

while (curl_multi_exec($this->handle, $runningCount) === CURLM_CALL_MULTI_PERFORM);

approach, we do something like

do{
    $err = curl_multi_exec($this->handle, $runningCount);
} while($err === CURLM_CALL_MULTI_PERFORM);
if($err !== CURLM_OK){
    throw new \RuntimeException(...)
}

also error info can be obtained by doing something like:

                $errinfo = [
                    "multi_exec_return" => $err,
                    "curl_multi_errno" => curl_multi_errno($mh),
                    "curl_multi_strerror" => curl_multi_strerror($err)
                ];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions