1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Allow arbitrary whitespace, not just horizontal spaces.
This commit is contained in:
Nikita Popov
2021-08-10 17:10:35 +02:00
parent e9b28528d6
commit 607be654fd
3 changed files with 34 additions and 1 deletions

4
NEWS
View File

@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.1.0beta3
- Core:
. Fixed bug #81342 (New ampersand token parsing depends on new line after it).
(Nikita)
- Date:
. Fixed bug #79580 (date_create_from_format misses leap year). (Derick)
. Fixed bug #80963 (DateTimeZone::getTransitions() truncated). (Derick)

View File

@@ -1858,7 +1858,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
RETURN_TOKEN(T_SR);
}
<ST_IN_SCRIPTING>"&"{TABS_AND_SPACES}("$"|"...") {
<ST_IN_SCRIPTING>"&"[ \t\r\n]*("$"|"...") {
yyless(1);
RETURN_TOKEN(T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG);
}

View File

@@ -0,0 +1,29 @@
--TEST--
Bug #81342: New ampersand token parsing depends on new line after it
--FILE--
<?php
$tokens = PhpToken::tokenize('<?php $x & $x; $x &
$baz;
');
foreach ($tokens as $token) {
echo $token->getTokenName(), "\n";
}
?>
--EXPECT--
T_OPEN_TAG
T_VARIABLE
T_WHITESPACE
T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG
T_WHITESPACE
T_VARIABLE
;
T_WHITESPACE
T_VARIABLE
T_WHITESPACE
T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG
T_WHITESPACE
T_VARIABLE
;
T_WHITESPACE