Bug #81632 [Opn->Fbk]: Shuffled parser tokens on PHP 8.1?
| From: | cmb@php.net | Date: | Wed, 17 Nov 2021 16:21:20 +0000 |
| Subject: | Bug #81632 [Opn->Fbk]: Shuffled parser tokens on PHP 8.1? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-237823@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81632&edit=1
ID: 81632
Updated by: cmb@php.net
Reported by: ondrej at mirtes dot cz
Summary: Shuffled parser tokens on PHP 8.1?
-Status: Open
+Status: Feedback
Type: Bug
Package: *General Issues
Operating System: Ubuntu
PHP Version: 8.1Git-2021-11-17 (Git)
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Looks good here: <https://3v4l.org/MJA67>.
How do you map the token values to string representations?
Previous Comments:
------------------------------------------------------------------------
[2021-11-17 16:11:23] ondrej at mirtes dot cz
Description:
------------
I have a really weird bug to report. I have a case of test failure that's happening on PHP 8.1
nightly in GitHub Actions and only on Ubuntu.
I tracked it down to weird value returned from
token_get_all when parsing this file: https://github.com/phpstan/phpstan-src/blob/master/src/Rules/Debug/DumpTypeRule.php
On other systems and versions, the exported tokens look correct: https://github.com/phpstan/phpstan-src/runs/4240472132?check_suite_focus=true
This is generally what I'd expect:
array (
0 =>
array (
0 => 'T_OPEN_TAG',
1 => '<?php ',
2 => 1,
),
1 =>
array (
0 => 'T_DECLARE',
1 => 'declare',
2 => 1,
),
2 => '(',
3 =>
array (
0 => 'T_STRING',
1 => 'strict_types',
2 => 1,
),
...
But on PHP 8.1 on Ubuntu, this is how the tokens look like
(https://github.com/phpstan/phpstan-src/runs/4240473383?check_suite_focus=true):
array (
0 =>
array (
0 => 'T_END_HEREDOC',
1 => '<?php ',
2 => 1,
),
1 =>
array (
0 => 'T_ENUM',
1 => 'declare',
2 => 1,
),
2 => '(',
3 =>
array (
0 => 'T_RETURN',
1 => 'strict_types',
2 => 1,
),
...
It's also possible it's a build issue that should be reported to the setup-php action, but
I decided to start here to track it down. Thank you.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81632&edit=1