PHP XDebug

Hi,

Is it possible to get a variable value programmatically when a PHP web application breaks while debugging with XDebug?

4 comments
Comment actions Permalink

Try XDebuggerManager().getInstance(project).getCurrentSession().getCurrentStackFrame().getEvaluator().evaluate() (with null checks added as appropriate).

0
Comment actions Permalink

IntelliJ doesn't recognize XDebuggerManager, and doesn't suggest any import.

---------------
Nevermind, removed the parenthesis and it recognizes.

Message was edited by: Alan Ng

0
Comment actions Permalink

I passed in the XEvaluationCallback into "evaluate" method, then in the "evaluated" method of the callback, how to get value of the XValue object (XdebugValue)? XdebugValue.getValue is a private method, and also doesn't return meaningful result.

0
Comment actions Permalink

Call computePresentation() passing your own implementation of XValueNode. Unfortunately it's the only API that we have; there is no real concept of a "value" that can be manipulated in the debugger API.

0

Please sign in to leave a comment.