CrashDump: do not assume that error_get_last() always returns array

this returns NULL if there was no error before the shutdown handler was triggered (usually caused by a plugin calling exit() prematurely).
This commit is contained in:
Dylan K. Taylor 2020-03-15 15:47:07 +00:00
parent 35490ca41c
commit 9c86763322

View File

@ -228,7 +228,10 @@ class CrashDump{
if(isset($lastExceptionError)){
$error = $lastExceptionError;
}else{
$error = (array) error_get_last();
$error = error_get_last();
if($error === null){
throw new \RuntimeException("Crash error information missing - did something use exit()?");
}
$error["trace"] = Utils::currentTrace(3); //Skipping CrashDump->baseCrash, CrashDump->construct, Server->crashDump
$errorConversion = [
E_ERROR => "E_ERROR",