Exception Breakpoints
I'm really trying to get 'Break on handled exceptions' to work but I just can't seem to get it to break. I've tried many different types but nothing seems to work.
I was hoping just 'Exception' would catch everything anyway as you don't always know what the original exception thrown was, but I have tried others when I know that that exception was thrown but still no break.
Have I just got to accept its another thing we're hoping xdebug is going to get working in the future or am I doing something wrong?
Please sign in to leave a comment.
Let's be specific. Please consider this code:
Add an exception breakpoint for the Exception type, and try debugging this code. Would it not stop for you on line 5?
No its not. I've add these breakpoints (desperation!)
I put a breakpoint on the line
Can reproduce that neither in the web mode nor in the CLI one: https://recordit.co/FCzYfrR9Xt
Please enable Xdebug remote log, retry your attempt to debug this code and then upload the log somewhere (like pastebin.com or elsewhere).
Wow, I'd love to be able to do what you showed me there! Here is the paste link https://pastebin.com/5YHyhKPn, the whole log was 78MB but there's a massive bit in the middle with just endless calls like:
[23411] E: E: Not a user defined function ((null))
[23411] E: E: Not a user defined function (getInitializer) etc for 78MB
I cut them out and it's just the top bit and bottom bit pasted - if the bit in the middle can help you let me know.
To make this log, I just ran your test proc.
I'm on Debian Buster
The only match for this line on the Internet I was able to find is in the Xdebug 2.9.0 sources:
...whatever the hell it means.
What I'd do if I was you:
Mmmm....unfortunately , I've got the version up to 2.9.4 and disabled all of the breakpoints except the 'Exception' one but nothing still.
Here's my 20-xdebug.ini,
I've tried a few other , any suggestions?
I have also been looking at this: https://www.jetbrains.com/help/phpstorm/debugging-in-the-jit-mode.html,
but unfortunately nothing....
I think that something in your interpreter configuration makes Xdebug fail, but unfortunately, I have no idea what it can be. Are you running the code locally?
If so, can you try some virtual machine (Vagrant, Docker, whatever) instead?
The spooky thing is I had this problem on Windows/Xampp as well as Debian and all the configs are OTB. Bit reluctant to create a VM....
Out of curiosity as I've never seen it working, do you have to know exactly the right exception thrown, the exception base class isn't good enough?
If so, that's often not that helpful anyway as you usually don't know the exact exception thrown in the first instance.
I am on Windows, here's what I just did:
php.ini-development
intophp.ini
php_xdebug-2.9.4-7.4-vc15-x86_64.dll
, copied it toext
, plugged it in inphp.ini
Everything worked as expected. I do agree that it would be really spooky if the same doesn't work for you.
No, Exception + Error should do the trick in all cases (at least as far as I understand it), all their children should be considered. You can also add Warning and Notice if you want.
Yeah, you can set a breakpoint for a base Exception and it would be still caught on a custom exception:
So, you were having this problem on various setups: did you use different PHP interpreters to test this?
Am I getting it right that using the code example above breakpoints work correctly on your end? But if you test this on your live code - they don't?
Ah!!! Yes its worked. On Windows, that's something ....but I need to revert to Debian. Every time i say apt-get update php/xdebug it says i've got the latest version though.
Clearing the config might be a first try...
Oh, just reverted the config to my old config and its broken (luckily!) so its in my config.
Any idea where in my config i might look?
Wow. Good news is I got it working on Debian by clearing config. My only changed setting is adding VS key mapping but I can't remember what else I changed but it seems to be working. Next time I change a setting I'll check its still breaking.
Thanks for all your help, I'm glad you persisted , its going to save me hours (and hours)
Sorry, it's difficult to tell. You can archive the config folder and share here or send it to us using Help | Contact Support mentioning this forum thread