From 687400043d77943ef95e8417cb44e1673ee57844 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Tue, 29 Oct 2024 13:24:25 +0100 Subject: [PATCH] Remove trace args in Exceptions (#691) * Remove trace args in Exceptions * Always cleanup args --- src/DebugBar/DataCollector/ExceptionsCollector.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/DebugBar/DataCollector/ExceptionsCollector.php b/src/DebugBar/DataCollector/ExceptionsCollector.php index 64adcf4..1ca1cfa 100644 --- a/src/DebugBar/DataCollector/ExceptionsCollector.php +++ b/src/DebugBar/DataCollector/ExceptionsCollector.php @@ -97,11 +97,22 @@ class ExceptionsCollector extends DataCollector implements Renderable if (isset($track['file'])) { $track['file'] = $this->normalizeFilePath($track['file']); } - return $track; }, $trace); } + // Remove large objects from the trace + $trace = array_map(function ($track) { + if (isset($track['args'])) { + foreach ($track['args'] as $key => $arg) { + if (is_object($arg)) { + $track['args'][$key] = '[object ' . $this->getDataFormatter()->formatClassName($arg) . ']'; + } + } + } + return $track; + }, $trace); + return $trace; }