On this page
function _drupal_shutdown_function
_drupal_shutdown_function()
Executes registered shutdown functions.
File
- includes/bootstrap.inc, line 3756
- 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 (Exception $exception) {
// If we are displaying errors, then do so with no possibility of a further uncaught exception being thrown.
require_once DRUPAL_ROOT . '/includes/errors.inc';
if (error_displayable()) {
print '<h1>Uncaught exception thrown in shutdown function.</h1>';
print '<p>' . _drupal_render_exception_safe($exception) . '</p><hr />';
}
}
}
© 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/includes!bootstrap.inc/function/_drupal_shutdown_function/7.x