开发者

How to get a stack-trace via api-call in xdebug?

We are using xdebug and the tracing work开发者_StackOverflow中文版s as advertised during code execution via..

 function someGetUsersHelper() {
     xdebug_start_trace();
     [SOME CODE HERE]
     xdebug_stop_trace();
}

It however only traces the wrapped part of the code if the page/script is executed via loading the full page in the browser via requesting

index.php

But tracing does not work, when we call the function as an api call via

index.php?api=getUsers

Even though the very same function is executed successfully it does not trace.

As an additional note: Tracing also works if the function is called from phpunit testcases or if we set xdebug.auto_trace = 1 in the php.ini, but that leaves us with a very long, messed up trace file.

So the question is this:

  • What might be the issue/reason for this and how can we manage to get the desired clear and succinct trace via api call?

Thanks a lot!!


I could not say why the trace is not working. But you could try this:

  1. Add the option xdebug.trace_enable_trigger=1 in your php configuration
  2. Now you could start a xdebug by adding XDEBUG_TRACE as POST/GET Parameter or as a cookie

There is also a Firefox Plugin called Easy XDebug to set the flags

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜