2

非常に奇妙な状況があります。以下に示すコードは、PHP でエラーを出力しないはずです。

try {
    throw new Exception('foo');
} catch(Exception $e) {
    // here could be some custom functions to handle errors
    die();
}

私のコンピューターでは印刷されます

( ! ) SCREAM: Error suppression ignored for
( ! ) Exception: foo. in D:\wamp\www\index.php on line 4

なんで?どのphp iniオプションがそれを行いますか?

4

3 に答える 3

5

The Scream extension is an extension aimed at developers, so that they get to see error messages from their code even when they would normally be suppressed.

xDebug is another developer extension that also includes the same functionality.

If you have either of these extensions, the Scream feature can be disabled in your PHP config.

But neither of those extensions should be in use on a production system -- they are intended for use on a developer's system only. If it's on your live site, then the extension should be disabled entirely.

于 2013-02-05T17:33:11.990 に答える
1

http://www.php.net/manual/en/scream.examples-simple.php

通常、screamは沈黙演算子(@)をオーバーライドするために使用されますが、try catchでもそれを実行する場合は、インラインini_setを使用してオフにし、修正されるかどうかを確認できます。

于 2013-02-05T17:25:21.883 に答える
1

回答ありがとうございました。はい、問題は xdebug でした。より正確にxdebug.show_exception_traceは、option. になりましたon

xdebugのドキュメントから読んだように:

xdebug.show_exception_trace
タイプ: 整数、デフォルト値: 0
この設定が 1 に設定されている場合、Xdebug は例外が発生するたびにスタック トレースを表示します (この例外が実際にキャッチされた場合でも)。

于 2013-02-05T17:41:25.520 に答える