views:

139

answers:

1

By default Xdebug will dump any exception regardless of whether it is caught or not:

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

With XDebug enabled and the default settings this piece of code will actually output something like the following (nicely formatted):

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

Is it possible to disable this behaviour and have it dumping only the uncaught exceptions?

Thanks in advance.

UPDATE: I'm about to conclude that this is a bug, since xdebug.show_exception_trace is disabled by default yet it doesn't behave as expected (using Xdebug v2.0.5 with PHP 5.2.10 on Ubuntu 9.10).

+1  A: 

Change the xdebug.show_exception_trace option (note it's not enabled by default).

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.

Artefacto
I agree this has something to do with xdebug.show_exception_trace. I think that when set to 0 it should ignore caught exceptions, but somehow this doesn't work even when disabling it explicitly.
nuqqsa
Talk to Derick on #php.pecl @ EFNet or use the bug tracker at http://bugs.xdebug.org/
Artefacto
This last comment makes your answer complete :) I'm definitely going to report this bug in case I can still reproduce it in 2.1.0RCx. Thanks.
nuqqsa