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

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

问题描述

我曾经在 Xdebug 2 中有以下配置:

I used to have the following configuration with Xdebug 2:

xdebug.default_enable=1

当没有调试客户端正在侦听时,Xdebug 不会减慢执行速度,但是当我需要调试某些内容时,我只需要在 PhpStorm 中启用侦听并刷新页面.这不需要浏览器扩展.同样适用于调试 CLI 应用程序,它可以正常工作.

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.

我尝试通过以下配置使用 Xdebug 3 实现相同的目标:

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

xdebug.mode=debug
xdebug.start_start_with_request=yes

每次当我在 PhpStorm 中禁用调试侦听并运行 CLI 命令时,它的工作原理都相同,但我收到以下消息,error 严重性:

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) :-(

这是我可以接受的东西,但它也会使 PHPUnit 测试失败 beStrictAboutOutputDuringTests=true" 已启用.

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

升级guide 建议使用 xdebug.module=开发 如果我使用了 xdebug.default_enable=1 但这不是有效的替代品.

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

完全静默所有 Xdebug 日志,甚至禁用 this 建议的 PHP 错误报告对我来说是一个肮脏的黑客可能的缺点而不是有效的解决方案.

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?

推荐答案

感谢您分享您对此 Derick 的想法.

thanks for sharing your thoughts about this Derick.

设置 xdebug.log_level=0 意味着您隐藏所有警告和错误,这使得无法调试任何内容.不要那样做.

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.

以前,很多人在让 Xdebug 工作时遇到问题,而这个警告对他们指出出现问题非常有用.

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...

我们公司有一个工作流,使用 xDebug 2,不需要任何额外的浏览器扩展或环境变量(见上文),只需要在 IDE 和魔法中启用监听 xDebug 连接......这是一个记录的解决方案和我们基于 Docker 的开发人员堆栈确保 xDebug 为每个开发人员工作 OOTB.(同样,没有任何额外的依赖)

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)

您是否建议 xDebug 3 不再支持此工作流程?

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

是否有机会向 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 如果调试客户端没有在监听,则没有错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆