You are here

function _drupal_shutdown_function in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/includes/bootstrap.inc \_drupal_shutdown_function()

Executes registered shutdown functions.

1 string reference to '_drupal_shutdown_function'
drupal_register_shutdown_function in core/includes/bootstrap.inc
Registers a function for execution on shutdown.

File

core/includes/bootstrap.inc, line 966
Functions that need to be loaded on every Drupal request.

Code

function _drupal_shutdown_function() {
  $callbacks =& drupal_register_shutdown_function();

  // Set the CWD to DRUPAL_ROOT as it is not guaranteed to be the same as it
  // was in the normal context of execution.
  chdir(DRUPAL_ROOT);
  try {
    while (list($key, $callback) = each($callbacks)) {
      call_user_func_array($callback['callback'], $callback['arguments']);
    }
  } catch (\Throwable $error) {
    _drupal_shutdown_function_handle_exception($error);
  } catch (\Exception $exception) {
    _drupal_shutdown_function_handle_exception($exception);
  }
}