summaryrefslogtreecommitdiff
path: root/framework/PradoBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/PradoBase.php')
-rw-r--r--framework/PradoBase.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/framework/PradoBase.php b/framework/PradoBase.php
index de8c4655..8a0c4a4d 100644
--- a/framework/PradoBase.php
+++ b/framework/PradoBase.php
@@ -84,6 +84,10 @@ class PradoBase
*/
set_error_handler(array('PradoBase','phpErrorHandler'));
/**
+ * Sets shutdown function to be Prado::phpFatalErrorHandler
+ */
+ register_shutdown_function(array('PradoBase','phpFatalErrorHandler'));
+ /**
* Sets exception handler to be Prado::exceptionHandler
*/
set_exception_handler(array('PradoBase','exceptionHandler'));
@@ -135,6 +139,23 @@ class PradoBase
}
/**
+ * PHP shutdown function used to catch fatal errors.
+ * This method should be registered as PHP error handler using
+ * {@link register_shutdown_function}. The method throws an exception that
+ * contains the error information.
+ */
+ public static function phpFatalErrorHandler()
+ {
+ $error = error_get_last();
+ if($error &&
+ TPhpErrorException::isFatalError($error) &&
+ error_reporting() & $error['type'])
+ {
+ self::exceptionHandler(new TPhpErrorException($error['type'],$error['message'],$error['file'],$error['line']));
+ }
+ }
+
+ /**
* Default exception handler.
* This method should be registered as default exception handler using
* {@link set_exception_handler}. The method tries to use the errorhandler