Index: branches/5.2.x/core/kernel/utility/debugger.php =================================================================== diff -u -N -r14585 -r14609 --- branches/5.2.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 14585) +++ branches/5.2.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 14609) @@ -1,6 +1,6 @@ rowSeparator = '@'.(is_object($application->Factory) ? $application->GetSID() : 0).'@'; + $this->rowSeparator = '@' . (is_object($application->Factory) ? $application->GetSID() : 0) . '@'; // $this->rowSeparator = '@'.rand(0,100000).'@'; // include debugger files from this url - $reg_exp = '/^'.preg_quote(FULL_PATH, '/').'/'; + $reg_exp = '/^' . preg_quote(FULL_PATH, '/') . '/'; $kernel_path = preg_replace($reg_exp, '', KERNEL_PATH, 1); - $this->baseURL = PROTOCOL.SERVER_NAME.(defined('PORT') ? ':'.PORT : '').rtrim(BASE_PATH, '/').$kernel_path.'/utility/debugger'; + $this->baseURL = PROTOCOL . SERVER_NAME . (defined('PORT') ? ':' . PORT : '') . rtrim(BASE_PATH, '/') . $kernel_path . '/utility/debugger'; // save debug output in this folder $this->tempFolder = defined('RESTRICTED') ? RESTRICTED : WRITEABLE . '/cache'; @@ -965,8 +967,13 @@ $trace_count = count($trace_results); $i = 0; while ($i < $trace_count) { + if ( !isset($trace_results[$i]['file']) ) { + $i++; + continue; + } + $trace_file = basename($trace_results[$i]['file']); - if ($trace_file != 'db_connection.php' && $trace_file != 'adodb.inc.php') { + if ($trace_file != 'db_connection.php' && $trace_file != 'db_load_balancer.php' && $trace_file != 'adodb.inc.php') { break; } $i++; @@ -977,6 +984,8 @@ if (array_key_exists('object', $trace_results[$i + 1]) && isset($trace_results[$i + 1]['object']->Prefix)) { $object =& $trace_results[$i + 1]['object']; + /* @var $object kBase */ + $prefix_special = rtrim($object->Prefix . '.' . $object->Special, '.'); $this->ProfilerData[$key]['prefix_special'] = $prefix_special; } @@ -1023,6 +1032,10 @@ $this->ProfilerData[$key]['subtitle'] = 'cachable'; } + if ($func_arguments[7]) { + $additional[] = Array ('name' => 'Server #', 'value' => $func_arguments[7]); + } + if (array_key_exists('prefix_special', $this->ProfilerData[$key])) { $additional[] = Array ('name' => 'PrefixSpecial', 'value' => $this->ProfilerData[$key]['prefix_special']); } @@ -1154,8 +1167,13 @@ /** * Generates report * + * @param bool $returnResult + * @param bool $clean_output_buffer + * + * @return string + * @access public */ - function printReport($returnResult = false, $clean_output_buffer = true) + public function printReport($returnResult = false, $clean_output_buffer = true) { if ($this->reportDone) { // don't print same report twice (in case if shutdown function used + compression + fatal error) @@ -1192,7 +1210,7 @@ $this->appendHTML($this->highlightString($this->print_r($this->ProfilePoints, true))); /*foreach ($this->ProfilePoints as $point => $locations) { - foreach ($locations as $location => $occurences) { + foreach ($locations as $location => $occurrences) { } @@ -1338,6 +1356,8 @@ $this->reportDone = true; } + + return ''; } /** @@ -1402,13 +1422,16 @@ /** * User-defined error handler * + * @throws Exception * @param int $errno * @param string $errstr * @param string $errfile * @param int $errline * @param array $errcontext + * @return bool + * @access public */ - function saveError($errno, $errstr, $errfile = '', $errline = '', $errcontext = '') + public function saveError($errno, $errstr, $errfile = null, $errline = null, $errcontext = Array ()) { $this->ProfilerData['error_handling']['begins'] = memory_get_usage(); @@ -1425,7 +1448,7 @@ } if ( DebuggerUtil::constOn('DBG_IGNORE_STRICT_ERRORS') && defined('E_STRICT') && ($errno == E_STRICT) ) { - return ; + return false; } $this->expandError($errstr, $errfile, $errline); @@ -1446,14 +1469,18 @@ // append debugger report to data in buffer & clean buffer afterwards die( $this->breakOutofBuffering(false) . $this->printReport(true) ); } + + return true; } /** * User-defined exception handler * - * @param Exception $errno + * @param Exception $exception + * @return void + * @access public */ - function saveException($exception) + public function saveException($exception) { $this->ProfilerData['error_handling']['begins'] = memory_get_usage(); @@ -1534,9 +1561,16 @@ $this->appendHTML($ret); } - function AttachToApplication() { - if (!DebuggerUtil::constOn('DBG_HANDLE_ERRORS')) { - return true; + /** + * Attaches debugger to Application + * + * @return void + * @access public + */ + public function AttachToApplication() + { + if ( !DebuggerUtil::constOn('DBG_HANDLE_ERRORS') ) { + return; } if ( class_exists('kApplication') ) { @@ -1551,8 +1585,8 @@ $this->Application->exceptionHandlers[] = Array (&$this, 'saveException'); } else { - set_error_handler( Array(&$this, 'saveError') ); - set_exception_handler( Array(&$this, 'saveException') ); + set_error_handler( Array (&$this, 'saveError') ); + set_exception_handler( Array (&$this, 'saveException') ); } }