cURL handle closed before calling curl_errno and curl_error
sjerdo opened this issue · 1 comments
sjerdo commented
Hi Jonathan,
First of all, thanks for creating this API wrapper.
I experience the following error for some requests to https://accounts.spotify.com/api/token
Warning: curl_error(): supplied resource is not a valid cURL handle resource
It seems like the cURL handle is closed before getting the require curl_errno and curl_error information in Request.php lines 221 - 223
if (curl_error($ch)) {
curl_close($ch);
throw new SpotifyWebAPIException('cURL transport error: ' . curl_errno($ch) . ' ' . curl_error($ch));
}I suggest changing this to first set these values or the error message in a variable, before closing the connection.
if (curl_error($ch)) {
$error = curl_error($ch);
$errno = curl_errno($ch);
curl_close($ch);
throw new SpotifyWebAPIException('cURL transport error: ' . $errno . ' ' .$error);
}jwilsson commented
Hi!
Nice catch! Would you like to send a PR with those changes?