Skip to content

devel disables standard drupal error handler when not configured

Problem/Motivation

I am upgrading Drupal 8 to 9, and with D9 I got a blank white page and HTTP status code 500 when opening http://drupal/admin in the browser. error_reporting was set to E_ALL in index.php, so the standard drupal error handler should be called - but it did not.

After a long debugging session I found, with the help of xdebug function traces, that devel 4.1.5 calls "restore_error_handler" from ErrorHandlerSubscriber::registerErrorHandler, nuking the default core error handler (devel_get_handlers() returns null here).

The code triggering the error was the s3fs module which called:

@trigger_error('S3FS: FileSystem::uriScheme() has been removed in core. Use \Drupal\Core\StreamWrapper\StreamWrapperManagerInterface::getScheme() instead. See https://www.drupal.org/node/3035273', E_USER_\
ERROR);

Due to the @ error silencing operator, the standard PHP error handler did not show the error and just ended the process.

Proposed resolution

devel should not restore the previous error handler when it did not set the error handler before.