1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-07 13:46:38 +02:00

Update Util.php

Fixes bug with error handler. Once `curl_close($ch)` is called, then `curl_errno($ch)` and `curl_error($ch)` makes no sense and will cause an error in the exception handler.
This commit is contained in:
Ahmet Soormally
2015-07-29 11:56:27 +01:00
parent e4f45be5dc
commit 7f0cc89685

View File

@@ -33,12 +33,18 @@ class Util
{
while ($retries--) {
if (curl_exec($ch) === false) {
if (false === in_array(curl_errno($ch), self::$retriableErrorCodes, true) || !$retries) {
$curlErrno = curl_errno($ch);
if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) {
$curlError = curl_error($ch);
if ($closeAfterDone) {
curl_close($ch);
}
throw new \RuntimeException(sprintf('Curl error (code %s): %s', curl_errno($ch), curl_error($ch)));
throw new \RuntimeException(sprintf('Curl error (code %s): %s', $curlErrno, $curlError));
}
continue;