aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2011-06-30 07:26:16 -0400
committerCash Costello <cash.costello@gmail.com>2011-06-30 07:26:16 -0400
commita9ede08f72287ecad0a794d56cb5501e2fdd96b9 (patch)
treeede012aa5320863581adaddc743f7b0e88adf964 /engine/lib/elgglib.php
parenta7b5ea1ee0ed37bae6091ba8fd98d529ba04707b (diff)
downloadelgg-a9ede08f72287ecad0a794d56cb5501e2fdd96b9.tar.gz
elgg-a9ede08f72287ecad0a794d56cb5501e2fdd96b9.tar.bz2
Adds exception handling to shutdown hook from pull request 50
Diffstat (limited to 'engine/lib/elgglib.php')
-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()}");
+ }
}
/**