&drupal_register_shutdown_function($callback = NULL)
Registers a function for execution on shutdown.
Wrapper for register_shutdown_function() that catches thrown exceptions to avoid "Exception thrown without a stack frame in Unknown".
$callback: The shutdown function to register.
...: Additional arguments to pass to the shutdown function.
Array of shutdown functions to be executed.
function &drupal_register_shutdown_function($callback = NULL) { // We cannot use drupal_static() here because the static cache is reset during // batch processing, which breaks batch handling. static $callbacks = array(); if (isset($callback)) { // Only register the internal shutdown function once. if (empty($callbacks)) { register_shutdown_function('_drupal_shutdown_function'); } $args = func_get_args(); // Remove $callback from the arguments. unset($args[0]); // Save callback and arguments $callbacks[] = array('callback' => $callback, 'arguments' => $args); } return $callbacks; }
© 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_register_shutdown_function/8.1.x