aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/elgglib.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index df78515f2..cb736f418 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1678,17 +1678,26 @@ function elgg_normalise_plural_options_array($options, $singulars) {
* useful. Servers will hold pages until processing is done before sending
* them out to the browser.
*
+ * @see http://www.php.net/register-shutdown-function
+ *
* @return void
* @see register_shutdown_hook()
*/
function _elgg_shutdown_hook() {
global $START_MICROTIME;
- elgg_trigger_event('shutdown', 'system');
+ try {
+ elgg_trigger_event('shutdown', 'system');
- $time = (float)(microtime(TRUE) - $START_MICROTIME);
- // demoted to NOTICE from DEBUG so javascript is not corrupted
- elgg_log("Page {$_SERVER['REQUEST_URI']} generated in $time seconds", 'NOTICE');
+ $time = (float)(microtime(TRUE) - $START_MICROTIME);
+ // demoted to NOTICE from DEBUG so javascript is not corrupted
+ elgg_log("Page {$_SERVER['REQUEST_URI']} generated in $time seconds", 'NOTICE');
+ } catch (Exception $e) {
+ $message = 'Error: ' . get_class($e) . ' thrown within the shutdown handler. ';
+ $message .= "Message: '{$e->getMessage()}' in file {$e->getFile()} (line {$e->getLine()})";
+ error_log($message);
+ error_log("Exception trace stack: {$e->getTraceAsString()}");
+ }
}
/**