Skip to content

Error reporting is broken #73

@arnaud-lb

Description

@arnaud-lb

The HTTP transport will always return ["error" => "", "code" => 0] in case of network error. This makes debugging difficult.

At line 207 below, we check if $response is false, but it's always a string. In case of network error, it will be the empty string, json_decode() fails, and ["error" => "", "code" => 0] is returned.

curl_exec($conn);
$response = ob_get_clean();
if ($response !== false) {
$data = json_decode($response, true);
if (!$data) {
$data = array('error' => $response, "code" => curl_getinfo($conn, CURLINFO_HTTP_CODE));
}
}
else {

Using curl_geterrno() === 0 instead of $response !== false fixes the problem.

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