4

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?

NoBugs
  • 9,310
  • 13
  • 80
  • 146
  • At least watches work fine in phpstorm (with xdebug) – zerkms Dec 17 '13 at 04:36
  • possible duplicate of [Xdebug And Netbeans Problem](http://stackoverflow.com/questions/4528569/xdebug-and-netbeans-problem) – Giacomo1968 Dec 17 '13 at 04:40
  • Same with Netbeans - even balloon watches work fine for most of the time - It should be noted this is a question about this specific problem, I already set up xdebug using something like the linked question. – NoBugs Dec 17 '13 at 05:08

1 Answers1

5

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.

bishop
  • 37,830
  • 11
  • 104
  • 139
  • Why is it marked "not fixable"? Couldn't they just add try-catch to the watch evalutation?? – NoBugs Dec 20 '13 at 05:34
  • Because the PHP engine aborts (not an exception), which aborts Xdebug, which stops the debugging session and breaks the remote connection. See specifically [this comment](http://bugs.xdebug.org/view.php?id=313#c775). PHP should be more graceful, but simply... [isn't.](http://www.codinghorror.com/blog/2012/06/the-php-singularity.html) – bishop Dec 20 '13 at 13:17