fix support of error control operators
This commit is contained in:
parent
0ca9ba2b24
commit
d35a492576
|
|
@ -7,6 +7,7 @@ class ExceptionHandler
|
||||||
public static function register()
|
public static function register()
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
if ($_SERVER['REQUEST_METHOD'] == "GET") {
|
||||||
|
// use closure to pass parameters
|
||||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||||
self::handler(
|
self::handler(
|
||||||
new \ErrorException($errstr, $errno, $errno, $errfile, $errline)
|
new \ErrorException($errstr, $errno, $errno, $errfile, $errline)
|
||||||
|
|
@ -17,6 +18,11 @@ class ExceptionHandler
|
||||||
|
|
||||||
public static function handler($e)
|
public static function handler($e)
|
||||||
{
|
{
|
||||||
|
// do nothing if error reporting is turned off or suppressed with @
|
||||||
|
if (error_reporting() === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch ($e->getCode()) {
|
switch ($e->getCode()) {
|
||||||
case E_PARSE:
|
case E_PARSE:
|
||||||
case E_ERROR:
|
case E_ERROR:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user