From ec236a59927b0ce41880d247677ab9855e71c486 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 23 Jul 2020 11:29:20 +0200 Subject: [PATCH] PHP 8.0 | Tokenizer/PHP: bug fix PHP 8.0 elevate a number of notices/warnings to errors, which now exposes a bug in the `goto` tokenizer logic. Error: `Trying to access array offset on value of type null` Fixed by making sure that the token being accessed is an array before trying to access it. --- src/Tokenizers/PHP.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Tokenizers/PHP.php b/src/Tokenizers/PHP.php index 61f9c2f798..5d5b3c95b6 100644 --- a/src/Tokenizers/PHP.php +++ b/src/Tokenizers/PHP.php @@ -1441,7 +1441,8 @@ function return types. We want to keep the parenthesis map clean, && $token[0] === T_STRING && isset($tokens[($stackPtr + 1)]) === true && $tokens[($stackPtr + 1)] === ':' - && $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM + && (is_array($tokens[($stackPtr - 1)]) === false + || $tokens[($stackPtr - 1)][0] !== T_PAAMAYIM_NEKUDOTAYIM) ) { $stopTokens = [ T_CASE => true,