From 85fc7f9d60f13bf00c322ceda40eed3f3e873e21 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 26 Jun 2023 19:04:47 +0200 Subject: guarantee array result on debug_backtrace, avoid doubling of long stack due to variable name collision --- it_debug.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/it_debug.class b/it_debug.class index 98f8484..d851ecc 100644 --- a/it_debug.class +++ b/it_debug.class @@ -77,7 +77,7 @@ static function debug_backtrace($p = []) { if (--$p['levels'] == 0) break; } - return $result; + return (array)$result; } /** @@ -229,8 +229,8 @@ static function backtrace($p = array()) { foreach ($frames as $frame) if ($tracesize < 100000 && ($tracesize += strlen(print_r($frame, true))) < 100000) # save mem - $frames[] = $frame; - $result = $frames ? print_r($frames, true) . "\n" : null; + $outframes[] = $frame; + $result = $outframes ? print_r($outframes, true) . "\n" : null; } else if ($p['format'] == "medium") { -- cgit v1.2.3