Skip to content

Commit 678b914

Browse files
author
Gasol Wu
committed
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
1 parent 0d6445b commit 678b914

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shared/ErrorHandler.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ private function renderException($exception): void {
140140
private function getLastError(): array {
141141
$error = \error_get_last();
142142

143-
if ($error && $error['type'] === \E_USER_NOTICE) {
143+
if ($error == null) {
144+
return [];
145+
} elseif ($error['type'] === \E_USER_NOTICE) {
144146
return [];
145147
}
146148

0 commit comments

Comments
 (0)