Simplify safe-guard code in MWExceptionHandler::handleFatalError
$file and $line are reported as possibly undefined in static code analyzer, but the $level = 0 does not pass self::$fatalErrorTypes, just return earlier Value 0 is not used: https://www.php.net/manual/en/errorfunc.constants.php Change-Id: Ib8431d6ed496ee50447c8c976afe17ebac03e156
This commit is contained in:
parent
b3e782ddbd
commit
1fe67f0395
1 changed files with 7 additions and 8 deletions
|
|
@ -300,16 +300,15 @@ class MWExceptionHandler {
|
|||
self::$reservedMemory = null;
|
||||
|
||||
$lastError = error_get_last();
|
||||
if ( $lastError !== null ) {
|
||||
$level = $lastError['type'];
|
||||
$message = $lastError['message'];
|
||||
$file = $lastError['file'];
|
||||
$line = $lastError['line'];
|
||||
} else {
|
||||
$level = 0;
|
||||
$message = '';
|
||||
if ( $lastError === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$level = $lastError['type'];
|
||||
$message = $lastError['message'];
|
||||
$file = $lastError['file'];
|
||||
$line = $lastError['line'];
|
||||
|
||||
if ( !in_array( $level, self::$fatalErrorTypes ) ) {
|
||||
// Only interested in fatal errors, others should have been
|
||||
// handled by MWExceptionHandler::handleError
|
||||
|
|
|
|||
Loading…
Reference in a new issue