From 678b914fef6b677800a33b79900d94d840c96f9c Mon Sep 17 00:00:00 2001 From: Gasol Wu Date: Wed, 27 Feb 2019 22:09:41 +0800 Subject: [PATCH] Fix bad exit status 255 generated by uncaught TypeError The error_get_last function returns NULL if there hasn't been an error yet, Says from from https://secure.php.net/error_get_last. PHP Fatal error: Uncaught TypeError: Return value of TheSeer\phpDox\ErrorHandler::getLastError() must be of the type array, null returned in /net/enterprise-data1/home/ad min/gasolwu/Code/phpdox/src/shared/ErrorHandler.php:147 Stack trace: #0 /net/enterprise-data1/home/admin/gasolwu/Code/phpdox/src/shared/ErrorHandler.php(55): TheSeer\phpDox\ErrorHandler->getLastError() #1 [internal function]: TheSeer\phpDox\ErrorHandler->handleShutdown() #2 {main} thrown in /net/enterprise-data1/home/admin/gasolwu/Code/phpdox/src/shared/ErrorHandler.php on line 147 --- src/shared/ErrorHandler.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/ErrorHandler.php b/src/shared/ErrorHandler.php index 3909e57f..1ce61895 100644 --- a/src/shared/ErrorHandler.php +++ b/src/shared/ErrorHandler.php @@ -140,7 +140,9 @@ private function renderException($exception): void { private function getLastError(): array { $error = \error_get_last(); - if ($error && $error['type'] === \E_USER_NOTICE) { + if ($error == null) { + return []; + } elseif ($error['type'] === \E_USER_NOTICE) { return []; }