Просмотр исходного кода

added php error message names to error handler

CauseFX 4 лет назад
Родитель
Сommit
7029d5c1ea
1 измененных файлов с 20 добавлено и 2 удалено
  1. 20 2
      api/classes/organizr.class.php

+ 20 - 2
api/classes/organizr.class.php

@@ -764,6 +764,24 @@ class Organizr
 		if (!(error_reporting() & $number)) {
 			return;
 		}
+		$exceptions = [
+			E_ERROR => 'E_ERROR',
+			E_WARNING => 'E_WARNING',
+			E_PARSE => 'E_PARSE',
+			E_NOTICE => 'E_NOTICE',
+			E_CORE_ERROR => 'E_CORE_ERROR',
+			E_CORE_WARNING => 'E_CORE_WARNING',
+			E_COMPILE_ERROR => 'E_COMPILE_ERROR',
+			E_COMPILE_WARNING => 'E_COMPILE_WARNING',
+			E_USER_ERROR => 'E_USER_ERROR',
+			E_USER_WARNING => 'E_USER_WARNING',
+			E_USER_NOTICE => 'E_USER_NOTICE',
+			E_STRICT => 'E_STRICT',
+			E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
+			E_DEPRECATED => 'E_DEPRECATED',
+			E_USER_DEPRECATED => 'E_USER_DEPRECATED',
+			E_ALL => 'E_ALL'
+		];
 		switch ($number) {
 			case E_USER_ERROR:
 			case E_ERROR:
@@ -793,14 +811,14 @@ class Organizr
 			$count = isset($GLOBALS['api']['response']['exceptions'][$type]) ? count($GLOBALS['api']['response']['exceptions'][$type]) : 0;
 			if ($count <= 10) {
 				$GLOBALS['api']['response']['exceptions'][$type][] = [
-					'error' => $number,
+					'error' => $exceptions[$number],
 					'message' => $message,
 					'file' => $file,
 					'line' => $line
 				];
 			}
 		}
-		$this->handleError($number, $message, $file, $line);
+		$this->handleError($exceptions[$number], $message, $file, $line);
 	}
 
 	public function setErrorResponse($number, $message, $file, $line)