Question

I'm debugging a huge and messy PHP codebase.

The application currently misbehaves and redirects all traffic to the login screen because it seems unable to start sessions.

I traced such a scenario with xDebug and only see main, with no branches at all.

Does this mean that an uncaught exception is unwinding the stack completely?

If that should be the case, is there a way to get a call graph even if that happens?

main

Was it helpful?

Solution

The callgraph should show all functions that have been called, of course, if none have been called you only see "main()" (for example, if in main you tried to call an undefined function). With Xdebug, you can trace which functions are called through "function tracing", which you can enable by setting "xdebug.auto_trace=1". You will then get a file in /tmp ending in .xt that lists all the function calls. You can also include more information as you can read about at http://www.xdebug.org/docs/execution_trace#collect_assignments

Another way of tackling the debugging is by using single-step debugging (also called, remote debugging) which many IDEs support combined with Xdebug. See for some more information: http://www.xdebug.org/docs/remote

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top