View Issue Details

IDProjectCategoryView StatusLast Update
0002276XdebugStep Debuggingpublic2024-07-07 11:04
Reportertefxacn Assigned To 
Status newResolutionopen 
Product Version3.3.2 
Summary0002276: Custom error handler return true will stop Exception handlers from breaking - returning false will write to PHP error log though

When using a custom error handler, I can return true; to avoid it bubbling up to PHP's native error handler (or any system defined handlers for that matter)*
This will obviously prevent xdebug breaking on the exception (assuming there is a PHP Exception breakpoint set up)

Therefore, one must return false to make xdebug work - that's fine.
The problem though is, that this (xdebug) will then bubble it up to the native PHP error handler and the error ends up in the PHP error log specified.

There needs to be a way to tell xdebug to NOT bubble up the error to PHP's native error handler, to prevent errors ending up in the error log.

e.g. xdebug_disable_next_error_bubble(); to skip bubbling of the next or xdebug_disable_error_bubble(); to disable it altogether; or possible a ini setting?


Steps To Reproduce
function log_error($type, $message, $file, $line) {
     // ...
     return true;
set_error_handler( 'log_error' );

$x = [15.7 => 'a'];

Will not break (and not report the error anywhere in this simplified example)
Change to return false; and it will break and also output the error to PHP error log

Additional Information

Possible solution:

function log_error($type, $message, $file, $line) {
     // ...
     if ( function_exists( 'xdebug_is_debugger_active' ) && xdebug_is_debugger_active() ) {
          return false;

     return true;
set_error_handler( 'log_error' );

$x = [15.7 => 'a'];

It will break at the error but not bubble the error to the PHP native error handler (bc xdebug itself will "return true;" basically)

TagsNo tags attached.
Operating System
PHP Version8.2.0-8.2.9



2024-07-07 11:04

reporter   ~0006983

Worked around it by just doing:

     if ( function_exists( 'xdebug_is_debugger_active' ) && xdebug_is_debugger_active() ) {

in log_error

Issue History

Date Modified Username Field Change
2024-06-18 10:10 tefxacn New Issue
2024-07-07 11:04 tefxacn Note Added: 0006983