Question

According to Netbeans docs and options pane, enabling the immediate evaluation ballons "destablizes" Xdebug: https://netbeans.org/kb/docs/php/debugging.html

I haven't heard of specific instances where this happens, and I didn't see any Xdebug bug listed - is this currently a bug they are fixing in Xdebug?? Is this warning still relevant in the latest release?

Was it helpful?

Solution

Here's what I undertand about the issue. NetBeans implements watches using PHP eval(). The expression being evaled may or may not be valid at the time the debugger enters a break state, per Xdebug bug 313.

In other debugging environments, such situations result in the watch being "disabled" in the UI, indicating the watch isn't available at this point in time. For example, in Chrome, you can watch anything and when the thing isn't in scope Chrome shows it as gray -- as soon as the thing is back in scope, Chrome shows it in black.

In PHP, however, the eval may abort PHP outright (see the Xdebug issue for examples), leading to Xdebug stopping debugging. This abort makes it appear that NetBeans has done something wrong, when in fact that's not true.

Provided you are careful with your watches (mind what they are and when they're reasonably valid), then you can enable this checkbox without issue. The safest thing you can do, though, is create synthetic variables to hold whatever you want to watch, and mind them in the "Variables" section, rather than watch arbitrary expressions.

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