mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Let debug_backtrace() example print out the class name, if applicable, and the function/method arguments.
This commit is contained in:
parent
38ef35e5b0
commit
7d85d01834
@ -510,11 +510,22 @@ Changes in the Zend Engine 2.0
|
||||
$backtrace = debug_backtrace();
|
||||
|
||||
foreach ($backtrace as $step) {
|
||||
$class = isset($step['class']) ? $step['class'] . '::' : '';
|
||||
if (!empty($step['args'])) {
|
||||
foreach ($step['args'] as $arg) {
|
||||
$args = isset($args) ? $args . ', ' : '';
|
||||
$args .= var_export($arg, true);
|
||||
}
|
||||
} else {
|
||||
$args = '';
|
||||
}
|
||||
|
||||
$args = str_replace("\n", '', $args);
|
||||
|
||||
printf(
|
||||
"%s [%s:%s]\n",
|
||||
"%s%s(%s) [%s:%s]\n",
|
||||
isset($step['class']) ? $step['class'] . '::' : '',
|
||||
$step['function'],
|
||||
$args,
|
||||
$step['file'],
|
||||
$step['line']
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user