phpwordpressdebug-backtrace

debug_print_backtrace doesn't work


I have PHP 5.3.4 and when I try to use debug_print_backtrace, I don't get anything. When I use vardump, I get an empty array, as you can see below.

index.php:

<?php
define('WP_USE_THEMES', true);

require('./wp-blog-header.php');

var_dump(debug_backtrace());

echo PHP_VERSION;
?>

which returns

...
</html> 
array(0) {
}
5.3.4

Can anyone tell me what is wrong? I am expecting to see everything that was called in the run. Instead I don't see anything.


Solution

  • debug_backtrace() doesn't show you what has been called so far but the current call stack (i.e. more or less where php would jump to on a return statement until it reaches the top level) when the function is invoked.
    You might be interested in a profiler like e.g. the one implemented in XDebug plus something to analyse the data like e.g. kcachegrind.