Break on Exception

If a fatal error occurs while your program is being debugged, PHP Tools breaks on it by default. Fatal error is an error which prevents the continuation of the script execution, e.g. parse error or unhandled exception.

Parse error

Now the debugger can be used to inspect the current program state. If you continue or step, the exception will continue being thrown until it is either handled or your program exits.

Some fatal errors (e.g. user-unhandled exception) are raised outside of running context after the script has finished. Inspection of the program state in this case doesn't work as script is not running anymore.

You can choose to break on any exception immediately when thrown. You can modify this settings in the Exceptions dialog. On the Debug menu, click Exceptions, and expand the PHP Exceptions entry. Here you can see all the exceptions that are already know and can be configured.

Exceptions configuration dialog

To configure an exception that does not appear in this list, click the Add button to add it. The name must match the full name of the exception precisely.

The left-hand checkbox ("Thrown") for each exception controls whether the debugger always breaks when it is raised. You should check this box when you want to break more often for a particular exception.

To configure an exception that does not appear in this list, click the Add button to add it. The name must match the full name of the exception precisely.

Common issues

Stepping through code works, but PHP exceptions are not thrown in Visual Studio

Check your php.ini for xdebug.default_enable directive and make sure it's set to 1 (this is default value).