沃梦达 / 编程问答 / php问题 / 正文

xdebug.start_start_with_request=yes 如果调试客户端没有监听,则没有错误

xdebug.start_start_with_request=yes WITHOUT error if the debug client is not listening(xdebug.start_start_with_request=yes 如果调试客户端没有监听,则没有错误)

本文介绍了xdebug.start_start_with_request=yes 如果调试客户端没有监听,则没有错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I used to have the following configuration with Xdebug 2:

xdebug.default_enable=1

Xdebug did not slow down execution when no debug client was listening but when I needed to debug something then I only had to enable the listening in PhpStorm and refresh the page. No browser extension was needed for this. The same applied for debugging CLI applications, it just worked.

I tried to achieve the same with Xdebug 3 with the following configuration:

xdebug.mode=debug
xdebug.start_start_with_request=yes

It works the same BUT every time when I disable debug listening in PhpStorm and run a CLI command I get the following message with error severity:

Xdebug: [Step Debug] Could not connect to debugging client. Tried: 172.17.0.1:9003 (through xdebug.client_host/xdebug.client_port) :-(

This is something that I could live with but it also makes PHPUnit tests fails beStrictAboutOutputDuringTests="true" is enabled.

The upgrade guide suggest to use xdebug.module=develop if I used xdebug.default_enable=1 but that is not a valid replacement.

Completely silencing ALL Xdebug logs or even disabling error reporting in PHP suggested by this comment looks a dirty hack to me with possible drawbacks instead of a valid solution.

How can I keep the expected behavior without this message?

解决方案

thanks for sharing your thoughts about this Derick.

Setting xdebug.log_level=0 means you hide all warnings and errors, which makes it impossible to debug anything. Don't do that.

I do not want to do this at all, but currently I do not see an another way around to keep the old behavior as I explained in the issue description.

Previously a lot of people were having issue with getting Xdebug to work, and having this warning is really useful to them to point out that something is going wrong.

I totally understand the motivation behind this new behavior and I also see it could be useful for many people. Although, the fact that this warning cannot be suppressed can cause problems to those who knows what they are doing.

Well, "what they are doing" is maybe an inappropriate phrase, what they want is probably better...

We had a workflow in our company with xDebug 2 that did not require any additional browser extension or environment variable (see above), just the listening to xDebug connection had to be enabled in the IDE and magic... It is a documented solutation and our Docker based developer stack made sure that xDebug worked OOTB for every developer. (Again, without any additional dependency)

Are you suggesting that this workflow is not supported anymore in xDebug 3?

Is there any chance to add a new configuration to xDebug 3 that would allow suppressing only these new warnings and enabling "expert mode"?

这篇关于xdebug.start_start_with_request=yes 如果调试客户端没有监听,则没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:xdebug.start_start_with_request=yes 如果调试客户端没有监听,则没有错误

基础教程推荐