Visual Studio中的PHP调试在每个异常中都会中断

gee*_*del 5 php debugging exception xdebug visual-studio-code

我刚开始在Visual Studio Code(Ubuntu 14.04)中使用PHP Debug扩展.它对我来说效果很好,但我有一个问题,每次抛出异常时,调试器会自动中断.我们有许多异常,这些异常在我们的代码中被内部捕获和处理,因此我不想逐步完成这些异常.

我一直试图找到类似Visual Studio 2015中的异常设置,但在Visual Studio Code中找不到任何等效选项.

php.ini设置:

[debug]
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=localhost
xdebug.remote_port=9000
Run Code Online (Sandbox Code Playgroud)

Visual Studio Code launch.json:

{
   "version": "0.2.0",
   "configurations": [      
       {
           "name": "Launch currently open script",
           "type": "php",
           "request": "launch",
           "program": "${file}",
           "cwd": "${fileDirname}",
           "port": 9000,
           "args": ["some arguments"]
       }
   ]
}
Run Code Online (Sandbox Code Playgroud)

请注意,当我使用相同的xdebug设置和相同的代码库来使用Netbeans进行调试时,没有违反异常的行为,因此我认为这必须是Visual Studio Code和/或PHP Debug扩展中的内容.

谁能建议如何在不破坏的情况下通过异常?

gee*_*del 24

我自己就找到了答案(现在感觉有点蠢!).

在Visual Studio Code中,转到View-> Debug,然后取消选中Breakpoints部分中的'Everything'按钮.该选项将自动中断PHP Notices,Warnings和Exceptions.

在此输入图像描述

  • +1 如果它让你感觉不那么 s*,我也觉得 s*...我不得不省略 s* 这个词,因为 Stack Overflow 认为我的评论没有建设性。 (2认同)
  • 哦!我也很想他们!感谢您留下这个答案。 (2认同)