Skip to content

Commit 2dcf71c

Browse files
committed
Merge branch 'PHP-8.0'
* PHP-8.0: Fixed bug #80462
2 parents 1071d85 + 7a61984 commit 2dcf71c

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Zend/zend_language_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
15581558

15591559
<ST_IN_SCRIPTING>"?->" {
15601560
yy_push_state(ST_LOOKING_FOR_PROPERTY);
1561-
return T_NULLSAFE_OBJECT_OPERATOR;
1561+
RETURN_TOKEN(T_NULLSAFE_OBJECT_OPERATOR);
15621562
}
15631563

15641564
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>{WHITESPACE}+ {

ext/tokenizer/tests/bug80462.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #80462: Nullsafe operator tokenize with TOKEN_PARSE flag fails
3+
--FILE--
4+
<?php
5+
6+
foreach (PhpToken::tokenize('<?php $foo = $a?->b();', TOKEN_PARSE) as $token) {
7+
echo $token->getTokenName(), "\n";
8+
}
9+
10+
?>
11+
--EXPECT--
12+
T_OPEN_TAG
13+
T_VARIABLE
14+
T_WHITESPACE
15+
=
16+
T_WHITESPACE
17+
T_VARIABLE
18+
T_NULLSAFE_OBJECT_OPERATOR
19+
T_STRING
20+
(
21+
)
22+
;

0 commit comments

Comments
 (0)