From 1abe0332c3ecace8766aef3dacd2e748ca113d3f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 17 Aug 2006 03:07:14 +0000 Subject: [PATCH] Error reporting now works, with the sacrificing of the ability to return ISSO messages --- Functions.php | 38 -------------------------------------- Loader.php | 41 +++++++++++++++++++---------------------- docs/changes.txt | 1 + 3 files changed, 20 insertions(+), 60 deletions(-) diff --git a/Functions.php b/Functions.php index 3128797..a6f9b42 100644 --- a/Functions.php +++ b/Functions.php @@ -647,44 +647,6 @@ class BSFunctions } return $array; } - - // ################################################################### - /** - * Prepares a debug_backtrace() array for output to the browser by - * compressing the array into visible text. This still has value because - * debug_print_backtrace() can't return data - * - * @param array debug_backtrace() array - * - * @return array Formatted trace output - */ - public static function FormatDebugTrace($backtrace) - { - $trace = array(); - foreach ($backtrace AS $i => $step) - { - $args = ''; - $file = $step['file'] . ':' . $step['line']; - $funct = (isset($step['class']) ? $step['class'] . '::' . $step['function'] : $step['function']); - - if (isset($step['args']) AND is_array($step['args'])) - { - // we need to do this so we don't get "Array to string conversion" notices - foreach ($step['args'] AS $id => $arg) - { - if (is_array($arg)) - { - $step['args']["$id"] = 'Array'; - } - } - $args = implode(', ', $step['args']); - } - - $trace[] = "#$i $funct($args) called at [$file]"; - } - - return $trace; - } } /*=====================================================================*\ diff --git a/Loader.php b/Loader.php index 242fa30..5425de7 100644 --- a/Loader.php +++ b/Loader.php @@ -153,6 +153,17 @@ class BSLoader } } + // ################################################################### + /** + * Determines if there's a main register set. If not, returns FALSE. + * + * @return bool Is there a main register set? + */ + public static function HasRegister() + { + return (isset(self::SharedInstance()->main) AND self::SharedInstance()->main instanceof BSRegister); + } + // ################################################################### /** * Loads the specified module. @@ -214,30 +225,16 @@ class BSLoader break; } - $backtrace = debug_backtrace(); - array_shift($backtrace); - - if (isset($backtrace[0]) AND $backtrace[0]['function'] == '_error_handler') - { - array_shift($backtrace); - } - - $trace = BSFunctions::FormatDebugTrace($backtrace); - - $output = "\n
\n"; - $output .= "\n\n\t\n"; - $output .= "\n\n\t\n"; - $output .= (($stack AND self::GetRegister()->getDebug()) ? "\n\n\t\n" : ''); - $output .= "\n
$prefix: $title
$message
Debug Stack:
" . implode("\n", $trace) . "
\n
\n"; - - if ($return) - { - return $output; - } - else + echo "\n
\n"; + echo "\n\n\t\n"; + echo "\n\n\t\n"; + if ($stack AND self::HasRegister() AND self::GetRegister()->getDebug()) { - print($output); + echo "\n\n\t\n"; } + echo "\n
$prefix: $title
$message
Debug Stack:
";
+			debug_print_backtrace();
+			echo "
\n
\n"; } // ################################################################### diff --git a/docs/changes.txt b/docs/changes.txt index 67c8b14..946236d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -2,4 +2,5 @@ =============== - Making it PHP5 native by implemnting visibility indicators - Removing TYPE_NOCLEAN in favor of TYPE_NONE +- Remove the option to return ISSO message HTML instead of printing it -- 2.22.5