From e5ee73841c5bcbab454d25e6e5ad65ecd6e165f7 Mon Sep 17 00:00:00 2001 From: Dustin Wilson Date: Tue, 16 Jan 2024 12:03:29 -0600 Subject: [PATCH] Further improvements to check for output throwable time in PlainTextHandler --- lib/Catcher/PlainTextHandler.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Catcher/PlainTextHandler.php b/lib/Catcher/PlainTextHandler.php index d081963..a4c2117 100644 --- a/lib/Catcher/PlainTextHandler.php +++ b/lib/Catcher/PlainTextHandler.php @@ -68,7 +68,8 @@ class PlainTextHandler extends Handler { $method = "{$frame['errorType']} ({$frame['class']})"; } elseif (isset($frame['function'])) { if (str_contains($frame['function'], '{closure}')) { - $method = "{$frame['function']}()"; + // We have no way of automatically testing this + $method = "{$frame['function']}()"; // @codeCoverageIgnore } else { $ref = new \ReflectionMethod($frame['class'], $frame['function']); $method .= (($ref->isStatic()) ? '::' : '->') . $frame['function'] . '()'; @@ -83,7 +84,7 @@ class PlainTextHandler extends Handler { $frame['line'] ); - if (isset($frame['args']) && $this->_backtraceArgFrameLimit > $key) { + if (isset($frame['args']) && count($frame['args']) > 0 && $this->_backtraceArgFrameLimit > $key) { $output .= preg_replace('/^/m', "$indent| ", $this->serializeArgs($frame['args'])) . \PHP_EOL; } }