Xdebug 2.3: Munging errors
This is the third article in a series about new features in Xdebug 2.3, which was first released on February 22nd.
One of the first features I added to Xdebug was the interception of error messages, so that it was possible to shows stack traces when an error occurred. Xdebug 2.3 has a few additional settings to control the behaviour of interception.
First, we have the new xdebug.halt_level. This setting allows you to tell Xdebug to convert certain warnings into fatal errors. Due to the way how PHP works, you can currently only do this for E_WARNING, E_NOTICE, E_USER_WARNING, and E_USER_NOTICE.
Setting xdebug.halt_level to E_NOTICE | E_USER_NOTICE will make the following script not show Hi!:
<?php
ini_set('xdebug.halt_level', E_USER_NOTICE | E_NOTICE);
trigger_error("Testing");
echo "Hi!\n";
?>
Instead, it will show the call stack, and then abort the script:
Notice: Testing in - on line 3
Call Stack:
0.0082 258480 1. {main}() -:0
0.0085 259400 2. trigger_error() -:3
This feature was requested by Rob Allen, who also wrote about it.
The second related improvement is the addition of the xdebug.force_display_errors and xdebug.force_error_reporting settings. These php.ini only settings can be used to override PHP's display_errors and error_reporting settings. This is typically useful in a legacy code base where developers tried to be clever about not showing warnings, or for example turning of notices that now hamper developer - or upgrade efforts.
Take the following script:
<?php
ini_set("display_errors", 0);
trigger_error("two");
?>
When you run this with just php thescript.php, the output will be nothing (because you are hiding errors). Running the example script with php -d
xdebug.force_display_errors=1 thescript.php, the output becomes:
Notice: two in /tmp/thescript.php on line 3
Call Stack:
0.0002 261072 1. {main}() /tmp/thescript.php:0
0.0002 261944 2. trigger_error() /tmp/thescript.php:3
The related setting xdebug.force_error_reporting acts at a bit mask to force certain errors to be shown. Even with error_reporting set to 0, the following script run with php -d xdebug.force_error_reporting
/tmp/otherscript.php will still show the errors:
<?php
ini_set("error_reporting", E_ERROR | E_WARNING | E_USER_WARNING);
trigger_error("two", E_USER_NOTICE);
?>
With as output:
Notice: two in /tmp/otherscript.php on line 3
Call Stack:
0.0002 261432 1. {main}() /tmp/otherscript.php:0
0.0003 262352 2. trigger_error() /tmp/otherscript.php:3
Other parts in this series:
Life Line
In more info innocent times, the hat riots caused some spankings...
100 Years Ago Men and Boys Fought on the Streets of New York Over Wearing Straw Hats Past Summer | The New York Public Library
https://www.nypl.org/blog/2022/09/23/straw-hat-riots-nycI hiked 15.5km in 3h12m14s
š· Mushroom Village
š© Weg van den Prins Willemsberg, Ellecom, Nederland
I walked 2.4km in 59m34s
š· National Cycle Network 6
š© Watford, United Kingdom
I walked 7.6km in 1h54m50s
š· Tufted Duck Pair
š© Outer Circle, City of Westminster, United Kingdom
RE: https://phpc.social/@Xdebug/115662135830755552
I have just released Xdebug 3.5.0!
In the next few weeks I will create some content (text, and perhaps video) highlighting some new features in more detail.
Please share it with the world!
The master branch is now for Xdebug 3.6, targetting PHP 8.6
Back to -dev
Tweak release instructions a little
Go with 3.5.0
Tweak message IDs and severities for control socket log entries
I walked 8.1km in 1h26m40s
I walked 1.1km in 9m28s
I walked 8.5km in 1h30m56s
My whisky of the month for December 2025, is a 15yo Aultmore bottled by Cadenhead's.
Fixed off-by-one error in address length name for control socket on Lā¦
Merged pull request #1050
Fixed control socket name by removing silly trailing things (by not pā¦




Shortlink
This article has a short URL available: https://drck.me/errors23-bns