From d35a492576efd792340e2ab1e8217d6551ee3fb4 Mon Sep 17 00:00:00 2001 From: printempw Date: Sat, 6 Aug 2016 18:47:10 +0800 Subject: [PATCH] fix support of error control operators --- app/Exceptions/ExceptionHandler.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Exceptions/ExceptionHandler.php b/app/Exceptions/ExceptionHandler.php index 48736675..9eeebcbb 100644 --- a/app/Exceptions/ExceptionHandler.php +++ b/app/Exceptions/ExceptionHandler.php @@ -7,6 +7,7 @@ class ExceptionHandler public static function register() { if ($_SERVER['REQUEST_METHOD'] == "GET") { + // use closure to pass parameters set_error_handler(function ($errno, $errstr, $errfile, $errline) { self::handler( new \ErrorException($errstr, $errno, $errno, $errfile, $errline) @@ -17,6 +18,11 @@ class ExceptionHandler public static function handler($e) { + // do nothing if error reporting is turned off or suppressed with @ + if (error_reporting() === 0) { + return; + } + switch ($e->getCode()) { case E_PARSE: case E_ERROR: