Can i make xdebug stop \ break on exceptions? (Ubuntu / Netbeans IDE / PHP 5.4 / CLI / xdebug)

I am running a PHP CLI application.

If I set a breakpoint, xdebug stops at it. if I write xdebug_break();, it also stops.

Can I stop it if the application throws an exception?

My ini file:

php -i | grep php.ini Uploaded configuration file => /etc/php5/cli/php.ini

xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
+4
source share
2 answers

I know this may be a bit late for the game, but you can use:

function my_exception_handler(Throwable $e) {

  if (function_exists('xdebug_break') )
    xdebug_break();

  die('Exception: ' . $e->getMessage() );

} // Function //

set_exception_handler('my_exception_handler');

As stated in the xdebug documentation:

bool xdebug_break ()

Gives a breakpoint for the debug client.

, ​​ /.

+2

All Articles