Arlen Beiler
Arlen Beiler

Reputation: 15876

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.

Upvotes: 2

Views: 6338

Answers (2)

Mark Baker
Mark Baker

Reputation: 212412

If you're really after Code Coverage (which it sounds like from your description) then XDebug is useful, or see the responses to this SO question

Upvotes: 2

VolkerK
VolkerK

Reputation: 96159

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.

Upvotes: 7

Related Questions