Skip to content

Commit 019f21a

Browse files
committed
Don't need to run the regex if the token is a string (ref #3178)
1 parent 0859719 commit 019f21a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Tokenizers/PHP.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ protected function tokenize($string)
899899
*/
900900

901901
if ($tokenIsArray === true
902-
&& preg_match('`^[a-zA-Z_\x80-\xff]`', $token[1]) === 1
902+
&& ($token[0] === T_STRING
903+
|| preg_match('`^[a-zA-Z_\x80-\xff]`', $token[1]) === 1)
903904
) {
904905
// Get the next non-empty token.
905906
for ($i = ($stackPtr + 1); $i < $numTokens; $i++) {

0 commit comments

Comments
 (0)