Become a Patron!

My Amazon wishlist can be found here.

Life Line

Contributing Advent 20: Xdebug halting on error

After Rob came up with the idea for xdebug_print_function_stack() from episode 17 he filed another issue. This new issue request thats a new setting to be added to Xdebug that allows users to decide whether notices and warnings should be treated as (fatal) errors. It's very much like GCC's -Werror setting which converts every compiler warning into an error that aborts the compilation process. The article for episode 4 talks a bit more about GCC's flags.

But as we are talking about PHP and Xdebug here, lets focus on this new feature that I added. xdebug.halt_level is a setting that allows you to configure a mask. This mask determines which notices get converted to errors. Right now, you can configure notices and warnings that are generated by PHP, and notices and warnings that you generate yourself (by means of trigger_error()). For example, to convert the warning of strlen() (without arguments) to an error, you would do:

ini_set('xdebug.halt_level', E_WARNING);

Which will then result in the showing of the error message, and the abortion of the script. echo "Hi!\n"; will not be executed.

The new setting is a bit mask, so to convert all notices and warnings into errors for all applications, you can set this in php.ini:


And that means, that errors created by trigger_error() also cause the termination of the script.

This new feature is going to be part of Xdebug 2.3. Stay tuned!


This article has a short URL available:


Ok this is good and it's probably a bit late to comment, but instead of halting it would be nice to make it stop (not error/exit) like a breakpoint. Or are we talking about the same thing? :)

Thanks for a great product!


@Andrew: Xdebug already supports that through an exception breakpoint on Notice. Not many IDEs support that though.

Add Comment


Will not be posted. Please leave empty instead of filling in garbage though!

Please follow the reStructured Text format. Do not use the comment form to report issues in software, use the relevant issue tracker. I will not answer them here.

All comments are moderated