summaryrefslogtreecommitdiff
path: root/framework/Exceptions/TException.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-02-26 09:27:38 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-02-26 09:27:38 +0100
commitb01aac13a3bc71eec9a934050e4cf0a9f58b02e7 (patch)
treec485e82d8e164744b74841fc1d7a6ad11a557796 /framework/Exceptions/TException.php
parent562e322fe595b4d3307ff28a96c8c5fbcc284010 (diff)
Intercept fatal errors using register_shutdown_function
Related discussion in #569
Diffstat (limited to 'framework/Exceptions/TException.php')
-rw-r--r--framework/Exceptions/TException.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php
index 651adb5a..033f7667 100644
--- a/framework/Exceptions/TException.php
+++ b/framework/Exceptions/TException.php
@@ -357,6 +357,17 @@ class TPhpErrorException extends TSystemException
$errorType=isset($errorTypes[$errno])?$errorTypes[$errno]:'Unknown Error';
parent::__construct("[$errorType] $errstr (@line $errline in file $errfile).");
}
+
+ /**
+ * Returns if error is one of fatal type.
+ *
+ * @param array $error error got from error_get_last()
+ * @return boolean if error is one of fatal type
+ */
+ public static function isFatalError($error)
+ {
+ return isset($error['type']) && in_array($error['type'], array(E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING));
+ }
}