找出警告处理器里的 bug

来自 错误处理
PHP 8.3.33 进阶 4分钟 找出 2处问题

找出被抑制的警告为何仍会抛出,以及后续测试为何会继承这项转换政策。

php
<?php
function withStrictWarnings(callable $operation): mixed
{
    set_error_handler(
        static function (int $severity, string $message, string $file, int $line): bool {
            throw new ErrorException($message, 0, $severity, $file, $line);
        },
    );
    return $operation();
}
在试验场中打开
报告错误