theseer / phpdox

Documentation generator for PHP Code using standard technology (SRC, DOCBLOCK, XML and XSLT)
http://phpdox.de
Other
599 stars 121 forks source link

Fix bad exit status 255 generated by uncaught TypeError #352

Closed Gasol closed 5 years ago

Gasol commented 5 years ago

The error_get_last function returns NULL if there hasn't been an error yet, And the exit status 255 is reserved by PHP and shall be used when fatal error occurred.

$ php -v
PHP 7.2.15-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Feb  8 2019 15:37:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.15-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans
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
theseer commented 5 years ago

Nice catch. I'm wondering though if the else if is required, given both branches return the same empty array.

The problem seems to have been that I did an && check originally. It probably should be if ($error === null || $error['....) {.

Or not?

Gasol commented 5 years ago

Nice catch. I'm wondering though if the else if is required, given both branches return the same empty array.

The problem seems to have been that I did an && check originally. It probably should be if ($error === null || $error['....) {.

Or not?

Updated, But the job is failed on Travis CI, Maybe failed on master too.

[ERROR]    PublicKey 4AA394086372C20A not found on key servers 
The command "phive --no-progress install --trust-gpg-keys 4AA394086372C20A,2A8299CE842DD38C,E82B2FB314E9906E" failed and exited with 4 during .