.stacktrace { background-color: #FFFFFF; color: #000000; }
.stacktrace .function { color: #0000FF; }
.stacktrace .number { color: #FF0000; }
.stacktrace .string { color: #009900; }
.stacktrace .bool { color: #000099; font-weight: bold; }
.stacktrace .null { color: #999999; font-weight: bold; }
.stacktrace .object { color: #009999; font-weight: bold; }
.stacktrace .array { color: #990099; }
.stacktrace .unknown { color: #669900; font-weight: bold; }
.stacktrace blockquote { padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px; }
";
}
$return .= "
Call Stack:
";
reset($bt);
$x=0;
while(list($key,$val)=each($bt)){
if ($x > 0 && $val['function'] != 'logd_error_handler'){
$return .= "$x: {$val['function']}(";
$y=0;
if ($val['args'] && is_array($val['args'])) {
reset($val['args']);
while (list($k,$v) = each($val['args'])){
if ($y > 0) $return.=", ";
$return.=backtrace_getType($v);
$y++;
}
} elseif ($val['args']) {
// If for some reason it's not an array, don't barf.
$return.=backtrace_getType($val['args']);
}
$return.=") called from {$val['file']} on line {$val['line']}
";
}
$x++;
}
$return.="
";
return $return;
}
function backtrace_getType($in){
$return = "";
if (is_string($in)){
$return.="\"";
if (strlen($in) > 25){
$return.=htmlentities(substr($in,0,25)."...", ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}else{
$return.=htmlentities($in, ENT_COMPAT, getsetting("charset", "ISO-8859-1"));
}
$return.="\"";
}elseif (is_bool($in)){
$return.="".($in?"true":"false")."";
}elseif (is_int($in)){
$return.="{$in}";
}elseif (is_float($in)){
$return.="".round($in,3)."";
}elseif (is_object($in)){
$return.="".get_class($in)."";
}elseif (is_null($in)){
$return.="NULL";
}elseif (is_array($in)){
if (count($in)>0){
$return.="Array(";
reset($in);
$x=0;
while (list($key,$val)=each($in)){
if ($x>0) $return.=", ";
$return.=backtrace_getType($key)."=>".backtrace_getType($val);
$x++;
}
$return.="
)";
}else{
$return.="Array()";
}
}else{
$return.="Unknown[".gettype($in)."]";
}
return $return;
}
?>