diff --git a/src/Monolog/Formatter/LineFormatter.php b/src/Monolog/Formatter/LineFormatter.php index 8c671aa9..fd9dc5bb 100644 --- a/src/Monolog/Formatter/LineFormatter.php +++ b/src/Monolog/Formatter/LineFormatter.php @@ -204,16 +204,15 @@ class LineFormatter extends NormalizerFormatter { $str = $this->formatException($e); - if (($previous = $e->getPrevious()) instanceof \Throwable) { - do { - $depth++; - if ($depth > $this->maxNormalizeDepth) { - $str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; - break; - } - - $str .= "\n[previous exception] " . $this->formatException($previous); - } while ($previous = $previous->getPrevious()); + $previous = $e->getPrevious(); + while ($previous instanceof \Throwable) { + $depth++; + if ($depth > $this->maxNormalizeDepth) { + $str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; + break; + } + $str .= "\n[previous exception] " . $this->formatException($previous); + $previous = $previous->getPrevious(); } return $str; diff --git a/src/Monolog/Handler/Curl/Util.php b/src/Monolog/Handler/Curl/Util.php index f1028114..6d78cb15 100644 --- a/src/Monolog/Handler/Curl/Util.php +++ b/src/Monolog/Handler/Curl/Util.php @@ -37,9 +37,10 @@ final class Util * @param CurlHandle $ch curl handler * @return bool|string @see curl_exec */ - public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true) + public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true): bool|string { - while ($retries--) { + while ($retries > 0) { + $retries--; $curlResponse = curl_exec($ch); if ($curlResponse === false) { $curlErrno = curl_errno($ch); @@ -53,7 +54,6 @@ final class Util throw new \RuntimeException(sprintf('Curl error (code %d): %s', $curlErrno, $curlError)); } - continue; } @@ -63,7 +63,6 @@ final class Util return $curlResponse; } - return false; } }