Download Summary

Transcript
Debugging
// skip the method where we turned an error into an
Exception
if ($aTrace['function'] != 'errorHandler') {
// init output for this trace
$output = array();
$output[] = "Backtrace step $count:";
// output class if given
if (array_key_exists('class', $aTrace)) {
$output[] = array('Class: ', $aTrace['class']);
}
// output type if given
if (array_key_exists('type', $aTrace)) {
$output[] = array('Type: ', $aTrace['type']);
}
// output function if given
if (array_key_exists('function', $aTrace)) {
$output[] = array('Function: ',
$aTrace['function']);
// output argument to function
if (array_key_exists('args', $aTrace)) {
$output[] = array('', 'with argument(s): ' .
implode(', ', $aTrace['args']));
}
}
// get source code of file that threw exception
$sourceExcerpt =
self::getSourceExcerpt($aTrace['file'], $aTrace['line']);
$output[] = 'Source code excerpt of lines ' .
$sourceExcerpt['start']
. ' through ' . $sourceExcerpt['end'] . '
of file ' . $aTrace['file'] . ':';
// highlight syntax for HTML output
if (self::$outputFormat == self::HTML) {
$output[] = array('', highlight_string(implode('',
[ 220 ]
Download from Wow! eBook
www.WoweBook.com