Skip to content

Commit

Permalink
Fatal error usually doesn't contain "file" and "line" fields in a sta…
Browse files Browse the repository at this point in the history
…cktrace. This causes Monolog\Formatter\NormalizerFormatter to return normalized error without "trace" field at all. But code expects it. Fix of this behavior. Check monolog related issue - Seldaek/monolog#1736
  • Loading branch information
WoZ committed Jul 20, 2022
1 parent 912a81a commit d06a0f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Formatter/LogstashFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function normalizeException(\Throwable $e, int $depth = 0)
{
$traceArray = parent::normalizeException($e, $depth);

if ($this->traceDepth !== 0) {
if ($this->traceDepth !== 0 && isset($traceArray['trace']) && is_array($traceArray['trace'])) {
$traceArray['trace'] = array_slice($traceArray['trace'], 0, $this->traceDepth);
}

Expand Down

0 comments on commit d06a0f7

Please sign in to comment.