From ba5681722bbb3df247cda8eb3f64c7e040e5bf00 Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 30 Oct 2010 22:00:56 +0000 Subject: fixed php exception and error handlers not being next to each other in elgglib git-svn-id: http://code.elgg.org/elgg/trunk@7142 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 1b078fde7..60c4e11ad 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -865,6 +865,34 @@ function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) return $returnvalue; } +/** + * Intercepts, logs, and display uncaught exceptions. + * + * @warning This function should never be called directly. + * + * @see http://www.php.net/set-exception-handler + * + * @param Exception $exception The exception being handled + * + * @return void + */ +function _elgg_php_exception_handler($exception) { + error_log("*** FATAL EXCEPTION *** : " . $exception); + + // Wipe any existing output buffer + ob_end_clean(); + + // make sure the error isn't cached + 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)); + page_draw(elgg_echo('exception:title'), $body); +} + /** * Intercepts catchable PHP errors. * @@ -1010,34 +1038,6 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') { } } -/** - * Intercepts, logs, and display uncaught exceptions. - * - * @warning This function should never be called directly. - * - * @see http://www.php.net/set-exception-handler - * - * @param Exception $exception The exception being handled - * - * @return void - */ -function _elgg_php_exception_handler($exception) { - error_log("*** FATAL EXCEPTION *** : " . $exception); - - // Wipe any existing output buffer - ob_end_clean(); - - // make sure the error isn't cached - 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)); - page_draw(elgg_echo('exception:title'), $body); -} - /** * Sends a notice about deprecated use of a function, view, etc. * -- cgit v1.2.3