function _drupal_shutdown_function_handle_exception

Same name in other branches
  1. 8.9.x core/includes/bootstrap.inc \_drupal_shutdown_function_handle_exception()
  2. 10 core/includes/bootstrap.inc \_drupal_shutdown_function_handle_exception()
  3. 11.x core/includes/bootstrap.inc \_drupal_shutdown_function_handle_exception()

Displays and logs any errors that may happen during shutdown.

Parameters

\Exception|\Throwable $exception: The exception object that was thrown.

See also

_drupal_shutdown_function()

1 call to _drupal_shutdown_function_handle_exception()
_drupal_shutdown_function in core/includes/bootstrap.inc
Executes registered shutdown functions.

File

core/includes/bootstrap.inc, line 752

Code

function _drupal_shutdown_function_handle_exception($exception) {
    // If using PHP-FPM then fastcgi_finish_request() will have been fired
    // preventing further output to the browser.
    if (!function_exists('fastcgi_finish_request')) {
        // If we are displaying errors, then do so with no possibility of a
        // further uncaught exception being thrown.
        require_once __DIR__ . '/errors.inc';
        if (error_displayable()) {
            print '<h1>Uncaught exception thrown in shutdown function.</h1>';
            print '<p>' . Error::renderExceptionSafe($exception) . '</p><hr />';
        }
    }
    error_log($exception);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.