aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-20 17:47:51 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-03-20 17:47:51 +0000
commited64c2973998507f797270be069feb64999c4af2 (patch)
tree25aa513bd0fb4a2af9beeff5db976aa36aa1731a
parentcac164a2d4d847718c859e1f5998ed714a7193e8 (diff)
downloadelgg-ed64c2973998507f797270be069feb64999c4af2.tar.gz
elgg-ed64c2973998507f797270be069feb64999c4af2.tar.bz2
Fixes #3198 handling exceptions thrown in exception handler by pointing to the error log
git-svn-id: http://code.elgg.org/elgg/trunk@8781 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/elgglib.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 1e4a1350d..5b0ff8365 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -942,7 +942,7 @@ function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = n
}
/**
- * Intercepts, logs, and display uncaught exceptions.
+ * Intercepts, logs, and displays uncaught exceptions.
*
* @warning This function should never be called directly.
*
@@ -962,11 +962,21 @@ function _elgg_php_exception_handler($exception) {
header("Cache-Control: no-cache, must-revalidate", true);
header('Expires: Fri, 05 Feb 1982 00:00:00 -0500', true);
// @note Do not send a 500 header because it is not a server error
- //header("Internal Server Error", true, 500);
- elgg_set_viewtype('failsafe');
- $body = elgg_view("messages/exceptions/exception", array('object' => $exception));
- echo elgg_view_page(elgg_echo('exception:title'), $body);
+ try {
+ // we don't want the 'pagesetup', 'system' event to fire
+ global $CONFIG;
+ $CONFIG->pagesetupdone = true;
+
+ elgg_set_viewtype('failsafe');
+ $body = elgg_view("messages/exceptions/exception", array('object' => $exception));
+ echo elgg_view_page(elgg_echo('exception:title'), $body);
+ } catch (Exception $e) {
+ $timestamp = time();
+ $message = $e->getMessage();
+ echo "Fatal error in exception handler. Check log for Exception #$timestamp";
+ error_log("Exception #$timestamp : fatal error in exception handler : $message");
+ }
}
/**