-
Notifications
You must be signed in to change notification settings - Fork 94
Open
Description
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.
elasticsearch/src/ElasticSearch/Transport/HTTP.php
Lines 205 to 213 in d033461
| 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels