On this page
function _drupal_shutdown_function
_drupal_shutdown_function()
Executes registered shutdown functions.
File
- core/includes/bootstrap.inc, line 970
- 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']);
}
}
// PHP 7 introduces Throwable, which covers both Error and
// Exception throwables.
catch (\Throwable $error) {
_drupal_shutdown_function_handle_exception($error);
}
// In order to be compatible with PHP 5 we also catch regular Exceptions.
catch (\Exception $exception) {
_drupal_shutdown_function_handle_exception($exception);
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!bootstrap.inc/function/_drupal_shutdown_function/8.1.x