Skip to content

Commit

Permalink
Fix bad exit status 255 generated by uncaught TypeError
Browse files Browse the repository at this point in the history
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()
    theseer#1 [internal function]: TheSeer\phpDox\ErrorHandler->handleShutdown()
    theseer#2 {main}
      thrown in /net/enterprise-data1/home/admin/gasolwu/Code/phpdox/src/shared/ErrorHandler.php on line 147
  • Loading branch information
Gasol Wu committed Feb 27, 2019
1 parent 0d6445b commit 678b914
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/shared/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [];
}

Expand Down

0 comments on commit 678b914

Please sign in to comment.