diff --git a/src/Monolog/ErrorHandler.php b/src/Monolog/ErrorHandler.php index 805f2dfd9..717831eea 100644 --- a/src/Monolog/ErrorHandler.php +++ b/src/Monolog/ErrorHandler.php @@ -194,8 +194,8 @@ private function handleException(\Throwable $e): never ($this->previousExceptionHandler)($e); } - if (!headers_sent() && \in_array(strtolower((string) \ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], true)) { - http_response_code(500); + if (\in_array(strtolower((string) \ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], true)) { + @http_response_code(500); } exit(255);