gpt4 book ai didi

php - 禁用 Xdebug 转储捕获的异常

转载 作者:可可西里 更新时间:2023-11-01 12:51:10 25 4
gpt4 key购买 nike

默认情况下,Xdebug 将转储任何异常,无论它是否被捕获:

try {
throw new Exception();
}
catch (Exception $e) {
}
echo 'life goes on';

在启用 XDebug 和默认设置的情况下,这段代码实际上会输出如下内容(格式良好):

( ! ) Exception: in /test.php on line 3 Call Stack
# Time Memory Function Location 1 0.0003 52596 {main}( ) ../test.php:0
life goes on

是否可以禁用此行为并让它仅转储未捕获的异常?

提前致谢。

更新:我即将得出结论,这是一个错误,因为默认情况下 xdebug.show_exception_trace 被禁用,但它没有按预期运行(使用 Xdebug v2.0.5 和 PHP 5.2。 10 在 Ubuntu 9.10 上)。

最佳答案

更改 xdebug.show_exception_trace选项(请注意默认情况下未启用)。

xdebug.show_exception_trace

Type: integer, Default value: 0

When this setting is set to 1, Xdebug will show a stack trace whenever an exception is raised - even if this exception is actually caught.

关于php - 禁用 Xdebug 转储捕获的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2904105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com