/usr/share/php/PHP/Compat/Function/debug_print_backtrace.php is in php-compat 1.6.0a3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | <?php
/**
* Replace debug_print_backtrace()
*
* @category PHP
* @package PHP_Compat
* @license LGPL - http://www.gnu.org/licenses/lgpl.html
* @copyright 2004-2007 Aidan Lister <aidan@php.net>, Arpad Ray <arpad@php.net>
* @link http://php.net/function.debug_print_backtrace
* @author Laurent Laville <pear@laurent-laville.org>
* @author Aidan Lister <aidan@php.net>
* @version $Revision: 274507 $
* @since PHP 5
* @require PHP 4.3.0 (debug_backtrace)
*/
function php_compat_debug_print_backtrace()
{
// Get backtrace
$backtrace = debug_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) || is_object($arg)) {
$desc = print_r($arg, true);
$desc = preg_replace('/\s+/', ' ', $desc);
$args[] = $desc;
} else {
$args[] = $arg;
}
}
$params = implode(', ', $args);
}
$calls[] = sprintf('#%d %s(%s) called at [%s]',
$i,
$function,
$params,
$location);
}
echo implode("\n", $calls), "\n";
}
// Define
if (!function_exists('debug_print_backtrace')) {
function debug_print_backtrace()
{
return php_compat_debug_print_backtrace();
}
}
|