Introduction

I am getting strange error in zf2. I don't know why, but I am getting some routing error. I don't get any messages, but needed controller is not loaded, but another one do. All looking fine, so it is not good idea to ask here to help me to solve this problem, so I am trying to debug this by myself.


What I have tried?

I tried debug_backtrace() function in /public/index.php file like this:

// Setup autoloading
require 'init_autoloader.php';

// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();

var_dump(debug_backtrace());

It shows nothing.

Just to check if function is working I tried:

function bob() {
    var_dump(debug_backtrace());
}

bob();

And this showed me what params were passed, what functions called etc. This showed me, that function is executed correctly, but this function is not used in my case.


Question

Is there any ways to get what functions was executed in app?

2

There are 2 best solutions below

3
On

I think you slightly misunderstand what debug_backtrace() does. It lists the function calls that led to the place in code where the backtrace is. So in your bob() example, it will show that function (as bob() was called). But if you just call debug_backtrace() in public/index.php, that's not executed within any functions, which is why you don't get any output.

0
On

I am not sure how reasonable it will be for you to install a different stack, but ZendServer has code tracing/profiling built in and that is exactly what you are looking for.