$this->_error('Invalid SQL query');
}
- $this->history[] = $history = array('query' => $string, 'time' => BSFunctions::FetchMicrotimeDiff($time), 'trace' => $this->_formatBacktrace(debug_backtrace()));
+ $this->history[] = $history = array('query' => $string, 'time' => BSFunctions::FetchMicrotimeDiff($time), 'trace' => BSFunctions::FormatBacktrace(debug_backtrace()));
if (defined('ISSO_SHOW_QUERIES_LIVE'))
{
exit;
}
}
-
- // ###################################################################
- /**
- * A backtrace formatter.
- *
- * This is very slightly modified from PEAR/PHP_Compat (PHP license)
- *
- * @author Laurent Laville <pear@laurent-laville.org>
- * @author Aidan Lister <aidan@php.net>
- *
- * @param array The backtrace from debug_backtrace() to format
- *
- * @return string Formatted output
- */
- private function _formatBacktrace($backtrace)
- {
- // Unset call to debug_print_backtrace
- array_shift($backtrace);
- if (empty($backtrace))
- {
- return '';
- }
-
- // Iterate backtrace
- $calls = array();
- foreach ($backtrace AS $i => $call)
- {
- if (!isset($call['file']))
- {
- $call['file'] = '(null)';
- }
- if (!isset($call['line']))
- {
- $call['line'] = '0';
- }
- $location = $call['file'] . ':' . $call['line'];
- $function = (isset($call['class'])) ? $call['class'] . (isset($call['type']) ? $call['type'] : '.') . $call['function'] : $call['function'];
-
- $params = '';
- if (isset($call['args']))
- {
- $args = array();
- foreach ($call['args'] AS $arg)
- {
- if (is_array($arg))
- {
- $args[] = print_r($arg, true);
- }
- elseif (is_object($arg))
- {
- $args[] = get_class($arg);
- }
- else
- {
- $args[] = $arg;
- }
- }
- $params = implode(', ', $args);
- }
-
- $calls[] = sprintf('#%d %s(%s) called at [%s]', $i, $function, $params, $location);
- }
-
- return implode("\n", $calls);
- }
}
/*=====================================================================*\
}
return $array;
}
+
+ // ###################################################################
+ /**
+ * A backtrace formatter.
+ *
+ * This is very slightly modified from PEAR/PHP_Compat (PHP license)
+ *
+ * @author Laurent Laville <pear@laurent-laville.org>
+ * @author Aidan Lister <aidan@php.net>
+ *
+ * @param array The backtrace from debug_backtrace() to format
+ *
+ * @return string Formatted output
+ */
+ public static function FormatBacktrace($backtrace)
+ {
+ // Unset call to debug_print_backtrace
+ array_shift($backtrace);
+ if (empty($backtrace))
+ {
+ return '';
+ }
+
+ // Iterate backtrace
+ $calls = array();
+ foreach ($backtrace AS $i => $call)
+ {
+ if (!isset($call['file']))
+ {
+ $call['file'] = '(null)';
+ }
+ if (!isset($call['line']))
+ {
+ $call['line'] = '0';
+ }
+ $location = $call['file'] . ':' . $call['line'];
+ $function = (isset($call['class'])) ? $call['class'] . (isset($call['type']) ? $call['type'] : '.') . $call['function'] : $call['function'];
+
+ $params = '';
+ if (isset($call['args']))
+ {
+ $args = array();
+ foreach ($call['args'] AS $arg)
+ {
+ if (is_array($arg))
+ {
+ $args[] = 'Array';
+ }
+ elseif (is_object($arg))
+ {
+ $args[] = get_class($arg);
+ }
+ else
+ {
+ $args[] = $arg;
+ }
+ }
+ $params = implode(', ', $args);
+ }
+
+ $calls[] = sprintf('#%d %s(%s) called at [%s]', $i, $function, $params, $location);
+ }
+
+ return implode("\n", $calls);
+ }
}
/*=====================================================================*\
if ($stack AND self::Instance()->getDebug())
{
echo "\n<tr style=\"background-color: #FFFFFF; text-align: left\">\n\t<td><strong>Debug Stack:</strong> <pre>";
- debug_print_backtrace();
+ echo BSFunctions::FormatBacktrace(debug_backtrace());
echo "</pre></td>\n</tr>";
}
echo "\n</table>\n<br />\n";