diff options
author | Urban Müller | 2023-06-26 19:04:47 +0200 |
---|---|---|
committer | Urban Müller | 2023-06-26 19:04:47 +0200 |
commit | 85fc7f9d60f13bf00c322ceda40eed3f3e873e21 (patch) | |
tree | 7eb771b5f21d4aa3dc93bda03960a00f34e37ffa | |
parent | 27507d2b3de7577bcbc5ab3b10fbc73a72152231 (diff) | |
download | itools-85fc7f9d60f13bf00c322ceda40eed3f3e873e21.tar.gz itools-85fc7f9d60f13bf00c322ceda40eed3f3e873e21.tar.bz2 itools-85fc7f9d60f13bf00c322ceda40eed3f3e873e21.zip |
guarantee array result on debug_backtrace, avoid doubling of long stack due to variable name collision
-rw-r--r-- | it_debug.class | 6 |
1 files 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") { |