Bug #81342 [NEW]: New ampersand token parsing depends on new line after it
From: werlos at gmail dot com
Operating system: linux
PHP version: 8.1.0beta2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:New ampersand token parsing depends on new line after it
Description:
------------
The "&" token is parsed as T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG when
space and then variable follows, but it's parsed to
T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG when newline and then variable
follows.
Test script:
---------------
<?php
$tokens = token_get_all('<?php $x & $x; $x &
$baz;
');
var_dump($tokens[3][1]);
var_dump(token_name($tokens[3][0]));
var_dump($tokens[10][1]);
var_dump(token_name($tokens[10][0]));
Expected result:
----------------
string(1) "&"
string(37) "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG"
string(1) "&"
string(37) "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG"
Actual result:
--------------
string(1) "&"
string(37) "T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG"
string(1) "&"
string(41) "T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG"
--
Edit bug report at https://bugs.php.net/bug.php?id=81342&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81342&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81342&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81342&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81342&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81342&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81342&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81342&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81342&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81342&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81342&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81342&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81342&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81342&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81342&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81342&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81342&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81342&r=mysqlcfg
Thread (2 messages)
- werlos at gmail dot com