Skip to content

Commit

Permalink
Merge pull request #809 from abraham/cleanup-curl
Browse files Browse the repository at this point in the history
Close curl on network exception
  • Loading branch information
abraham committed Nov 29, 2019
2 parents b133d35 + a9c5f4a commit 728fc83
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/TwitterOAuth.php
Expand Up @@ -543,7 +543,10 @@ private function request($url, $method, $authorization, array $postfields, $json

// Throw exceptions on cURL errors.
if (curl_errno($curlHandle) > 0) {
throw new TwitterOAuthException(curl_error($curlHandle), curl_errno($curlHandle));
$error = curl_error($curlHandle);
$errorNo = curl_errno($curlHandle);
curl_close($curlHandle);
throw new TwitterOAuthException($error, $errorNo);
}

$this->response->setHttpCode(curl_getinfo($curlHandle, CURLINFO_HTTP_CODE));
Expand Down

0 comments on commit 728fc83

Please sign in to comment.