xdebug中的php var_dump()忽略__debuginfo()魔法方法

发布于 2025-01-23 07:37:00 字数 225 浏览 2 评论 0原文

当使用var_dump()时,Xdebug似乎忽略了php魔法方法debuginfo()

注射依赖关系(带有依赖关系,依赖关系...)时,这尤其不合时宜。

是否有Xdebug的var_dump()的设置,因此可以按预期与debuginfo()一起使用?还是PHP中的解决方法?我找不到任何东西。

Xdebug seems to ignore PHP magic method __debugInfo() in user defined classes when using var_dump().

This is especially unhandy when injecting dependencies (with dependencies, with dependencies...).

Is there a setting for Xdebug's var_dump() so it works with __debugInfo() as expected? Or a workaround in PHP maybe? I could not find anything.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静若繁花 2025-01-30 07:37:00

Xdebug的理念是显示对象中存在的数据,以帮助调试。显示所有属性,而不仅仅是__ debuginfo()返回的属性。

有一个用于步骤调试的方法代码> var_dump()。您可以关闭Xdebug的“开发工具”,但是,不在xdebug.mode php.ini设置中不包括开发

Xdebug's philosophy is to show data as it exists in objects, to aid debugging. Having all the properties shown, and not just the ones that __debugInfo() returns follows this convention.

There is a workaround for step debugging, but not for the overloaded var_dump(). You can turn off Xdebug's "Development Tools" however, by not including develop in the xdebug.mode php.ini setting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文