I'm using plugin PHP Debugger in Visual Studio Code to debug PHP codes. All were ok with PHP <= 5.6. The debugger worked like a charm. But when I try to debug the code with PHP 7, it does not work as expected. It does not jump to the break points I added, I was stuck at thounsand excepton like
Exception has occurred. Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; RecurringType has a deprecated constructor
Or
Exception has occurred. Warning: Declaration of AntlrLexer::matchAny() should be compatible with BaseRecognizer::matchAny($input)
Or
Exception has occurred. Notice: Trying to get property of non-object
These exception are generated by the Framework so I can not fix them all, I just want to skip all these exceptions and jump to my break points only.
How can I achieve that? Thanks.
Tell the debugger to break when an exception is thrownIn the Exception Settings window (Debug > Windows > Exception Settings), expand the node for a category of exceptions, such as Common Language Runtime Exceptions. Then select the check box for a specific exception within that category, such as System.
I don't know if this will work with your configuration (I'm using PHP 7.2 with WordPress), and have found this works to keep XDebug from triggering every Exception, Warning, Notice, etc. if I just want to step through my own sections of code.
First, uncheck everything (including Everything
, if checked) in the Breakpoints
debug section:
Then hover over the Breakpoints
bar and click the +
:
Now add the name of a function you want to debug:
Finally, set a breakpoint within that function. You will now be able to trigger an XDebug step-through only within that function:
You can, presumably, add as many of your own function breakpoints as you want. An interesting aside is that if you have multiple functions with the same name, you only have to add the function name once.
In my case the extension or editor came with the EVERYTHING option checked by default. Unchecking EVERYTHING checkbox fixed the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With