improved error check on shutdown
This commit is contained in:
		| @@ -111,9 +111,9 @@ class ErrorHandler { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
| 	 * Triggers a Debug Notice to the ManiaControl Website | 	 * Trigger a Debug Notice to the ManiaControl Website | ||||||
| 	 * | 	 * | ||||||
| 	 * @param $message | 	 * @param string $message | ||||||
| 	 */ | 	 */ | ||||||
| 	public function triggerDebugNotice($message) { | 	public function triggerDebugNotice($message) { | ||||||
| 		$this->handleError(self::MC_DEBUG_NOTICE, $message); | 		$this->handleError(self::MC_DEBUG_NOTICE, $message); | ||||||
| @@ -263,4 +263,14 @@ class ErrorHandler { | |||||||
| 	private function shouldStopExecution($errorNumber) { | 	private function shouldStopExecution($errorNumber) { | ||||||
| 		return ($errorNumber === E_ERROR || $errorNumber === E_USER_ERROR || $errorNumber === E_FATAL); | 		return ($errorNumber === E_ERROR || $errorNumber === E_USER_ERROR || $errorNumber === E_FATAL); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * Check if the Shutdown was caused by a Fatal Error and report it | ||||||
|  | 	 */ | ||||||
|  | 	public function handleShutdown() { | ||||||
|  | 		$error = error_get_last(); | ||||||
|  | 		if ($error && ($error['type'] & E_FATAL)) { | ||||||
|  | 			$this->handleError($error['type'], $error['message'], $error['file'], $error['line']); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
| }  | }  | ||||||
| @@ -302,11 +302,7 @@ class ManiaControl implements CommandListener, TimerListener { | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		// Check and Trigger Fatal Errors | 		$this->errorHandler->handleShutdown(); | ||||||
| 		$error = error_get_last(); |  | ||||||
| 		if ($error && ($error['type'] & E_FATAL)) { |  | ||||||
| 			$this->errorHandler->handleError($error['type'], $error['message'], $error['file'], $error['line']); |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		// Disable Garbage Collector | 		// Disable Garbage Collector | ||||||
| 		$this->collectGarbage(); | 		$this->collectGarbage(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user