5

Hopefully the following will give you enough to go on.

My setup

I'm using:

  • Windows 10 (now at build 19043.1288),
  • VSCode (v1.61.2) with
  • PHP debug (v1.21.1),
  • both Firefox and Google Chrome browsers,
  • XAMPP (v3.3.0)
  • Xdebug (now v3.1.1-7.4x86_64)
  • I'm also running Ubiquiti network controller, and BitDefender AV in the background.

PHP.ini

[Xdebug]
zend_extension = xdebug
;zend_extension = "c:\xampp\php\ext\php_xdebug-3.1.1-7.4-vc15-x86_64.dll"

xdebug.remote_enable=1
xdebug.remote_autostart=1

xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.log = "c:\xampp\htdocs\j4\tmp\xdebug.log"

Problem

I've had VSCode/XAMPP/Xdebug working with Joomla 3 for well over a year without issues. I went away for a couple of weeks and when I came back I wasn't able to single step into any of the Joomla 3 modules/classes. VSCode would stop at breakpoint, but both single step and step into immediately went to the parent calling function.

Ah, I said to myself, probably Windows did something - may be a good time to upgrade to J4, as well as update my environment. Same problem. Stops at 1st breakpoint, won't single step or step into - it won't stop at subsequent breakpoints. Appears to single step in the core J4 modules. Stack appears normal - initialised variables can be inspected.

What I've tried

Everything! To keep this relevant - I've now installed a completely fresh, out of the box, unadulterated, XAMPP, Joomla4 and Xdebug (as recommended by Xdebug wizard). I've also temporarily disabled my AV (BitDefender). I don't have any firewalls on my PC, as I'm behind a network firewall.

Just in case, I did a deep virus scan and disk check - nothing.

Prior to installing everything fresh, I was able to get an Xdebug log file, but now I can't. I also noted that the breakpoints wouldn't reset - I'd remove all the BPs and they'd come back on next run. I'd have to stop and restart the PHP debug in VSCode to make them go away.

I suspect that the latest Windows updates (or maybe the last few), did something to my dev environment. However, it's also possible that I've missed something stupid in the setup, as I've been round the circuit several times already, and my head isn't functioning as it should.

Where I need help

I'm now at a loss at what to try next - any suggestions? If no-one else can reproduce this - it means something in my system has glitched, any help would be appreciated.

Update 1

I discovered that a v2 of Xdebug had crept into my php/ext directory - not too sure how - and that was why I wasn't able to get a log file to work. I now have the correct version (3.1.1) of Xdebug installed and working. The single step issue, however, remains.

I now have a log from VSC debug console as well as from xdebug.log: see here

One thing I observe is that there are many errors associated with deprecated functions - I would have expected them to be warnings and not errors!

There are also numerous cases of "error evaluating code".

I have highlighted the place where the code stopped in the logs with "************". I don't know if this is expected or normal, but it does seem to occur a short time before the breakpoint stop - line 431 vs line 651 in the debug console log.

Update 2

Just in case anyone has any interest - I installed the latest version of Eclipse IDE with PDT. Used exactly the same XAMPP/htdocs directory as before - and Xdebug works as expected. No issues with single stepping.

This means, I believe, that Windows, XAMPP, Xdebug and Joomla can be ruled out as culprits, as these are common to both environments. Conversely, it also means that there's something going on with VSCode, or at least with my particular VSCode setup.

Breakthrough (I think!)

It appears that a couple of variables (e.g. $this->missingclasses) I had put into the watch window were causing the problem. I suspect that over the course of a few VSCode updates the persistent internal objects associated with those variables had glitched/corrupted. When I deleted the offending variable watches - single step started to work again.

After seeing that that worked, I was able to put the watches back and single stepping worked as expected. Putting the same watched variables into Eclipse had no effect on single stepping.

Just for good measure, I also deleted and reinstalled PHP Debug - although I'm pretty sure the watched variables, that couldn't be evaluated, were the real issue here.

I will leave this a couple of days, and then I'll close this with a suggested solution

pjl55
  • 51
  • 2
  • 1
    I was having the same problem with a different setup: VSCode + Docker container, XDebug 3. No Joomla. The solution was exactly as you hint - I cleared out all my watches and it came back to life. Hadn't updated VSCode, though - don't know why the debugger was behaving this way. – willw Jan 17 '22 at 17:19
  • Thank you, man! You saved my day. Clearing out all the watches is the solution! – Ma3x Feb 01 '23 at 11:49

0 Answers0