From ee3652acad71b4dd8eac6684ad6f23a2e32c202f Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Sun, 31 Jul 2011 08:57:04 +0000 Subject: [PATCH] Added a useful function for debugging: DebugBacktrace which provides a "light" version of PHP's built-in debug_backtrace(). SVN:trunk[1392] --- application/utils.inc.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/application/utils.inc.php b/application/utils.inc.php index bc5f1878c..4e3de3873 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -504,5 +504,16 @@ class utils } } } + + static function DebugBacktrace($iLimit = 5) + { + $aFullTrace = debug_backtrace(); + $aLightTrace = array(); + for($i=1; ($i<=$iLimit && $i < count($aFullTrace)); $i++) // Skip the last function call... which is the call to this function ! + { + $aLightTrace[$i] = $aFullTrace[$i]['function'].'(), called from line '.$aFullTrace[$i]['line'].' in '.$aFullTrace[$i]['file']; + } + echo "

".print_r($aLightTrace, true)."

\n"; + } } ?>