Debug with PHP exception breakpoints
With PHP Exception Breakpoints, you can initiate the debugger at the start of the script and break on your own breakpoints or whenever an error or Exception of a given type occurs. PHP Exception breakpoints do not require configuring Xdebug for working in the Just-In-Time mode by setting xdebug.remote_mode=jit
(for Xdebug 2) or xdebug.start_upon_error=yes
(for Xdebug 3) as described in Debug in the Just-In-Time mode.
This functionality relies on the PHP plugin, which you need to install and enable.
note
The PHP plugin is available only in IntelliJ IDEA Ultimate.
Press CtrlAlt0S to open the IDE settings and select Plugins.
Open the Marketplace tab, find the PHP plugin, and click Install (restart the IDE if prompted).
From the main menu, choose Run | View Breakpoints, or press CtrlShiftF8.
In the Breakpoints dialog that opens, click
.
From the list, choose PHP Exception Breakpoints.
In the Add Exception Breakpoint dialog that opens, specify the errors or exceptions on which you want the debugger to suspend.
To break on PHP error conditions, choose one of the standard types from the list, the available options are Warning, Notice, or Deprecated.
Alternatively, specify a custom Exception type. Note that E_ERROR, E_PARSE, and E_COMPILE_ERROR are not handled as they halt execution of the PHP engine.
When ready, click OK to returns you to the Breakpoints dialog.
Configure the new exception breakpoint as described in Breakpoints.
When the debugger breaks on an error or an exception, IntelliJ IDEA sets a PHP Exception Breakpoint.
To see the breakpoint type, hover the mouse pointer over the breakpoint. The type is displayed in a popup:
The Variables pane displays a fake
Exception
variable which shows the exception message and the exception code:To get more information on PHP errors, add a watch for the
error_get_last()
function, see Watches. Then the details of errors will be displayed in the Watches pane:
Thanks for your feedback!