From 44203e70325ea67b6d3170a34ab0bee7b2d20c98 Mon Sep 17 00:00:00 2001 From: Andreas Schroth Date: Sat, 30 Nov 2019 01:19:46 +0100 Subject: [PATCH] Fix PHP 7.4 warning for invalid array access error_get_last() might return null and then an invalid array access occurs. For more information see this RFC: https://wiki.php.net/rfc/notice-for-non-valid-array-container --- lib/Exceptions/AbstractSafeException.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Exceptions/AbstractSafeException.php b/lib/Exceptions/AbstractSafeException.php index 2e36f09c..1e426242 100644 --- a/lib/Exceptions/AbstractSafeException.php +++ b/lib/Exceptions/AbstractSafeException.php @@ -8,6 +8,10 @@ abstract class AbstractSafeException extends \ErrorException implements SafeExce public static function createFromPhpError(): self { $error = error_get_last(); + + if ($error === null) { + return new static(); + } return new static($error['message'], 0, $error['type']); }