Reputation: 1181
Consider this sample code:
<?
try {
throw new Exception('new');
} catch (Exception $ex) {
echo "caught";
}
?>
I assume this should just output the string "caught" when run. However, with display errors turned on, I see the exception shown on the web page like ( ! ) Exception: new in test.php on line 2
along with a dump of call stack and variables in scope.
With display errors off, it doesn't show the exception notice. Shouldn't the try catch block prevent the notice to be shown even with display errors on?
Upvotes: 0
Views: 319
Reputation: 116
If you are using xdebug and you do not want to disable xdebug or error reporting and you do not want trace messages of caught exceptions to appear, you can turn off the display of the exception trace with
xdebug.show_exception_trace = 0
in your php.ini
Upvotes: 1