Permalink
Browse files

FIX Only suppress fatal errors

  • Loading branch information...
1 parent 604d9bf commit 84011aa736bb9a029b47dad5b6404f68f9674aef Hamish Friedlander committed Jul 22, 2013
Showing with 11 additions and 2 deletions.
  1. +11 −2 core/startup/ErrorControlChain.php
@@ -18,6 +18,8 @@
* It will likely be heavily refactored before the release of 3.2
*/
class ErrorControlChain {
+ public static $fatal_errors = null; // Initialised after class definition
+
protected $error = false;
protected $steps = array();
@@ -67,8 +69,12 @@ public function thenAlways($callback) {
}
public function handleError($errno, $errstr) {
- if ((error_reporting() & $errno) == $errno && $this->suppression) throw new Exception('Generic Error');
- else return false;
+ if ((error_reporting() & self::$fatal_errors & $errno) != 0 && $this->suppression) {
+ throw new Exception('Generic Error');
+ }
+ else {
+ return false;
+ }
}
protected function lastErrorWasFatal() {
@@ -117,3 +123,6 @@ protected function step() {
}
}
}
+
+ErrorControlChain::$fatal_errors = E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERROR;
+if (defined('E_RECOVERABLE_ERROR')) ErrorControlChain::$fatal_errors |= E_RECOVERABLE_ERROR;

0 comments on commit 84011aa

Please sign in to comment.