Bug #81632 [Fbk]: Shuffled parser tokens on PHP 8.1?

From: Date: Wed, 17 Nov 2021 18:57:52 +0000
Subject: Bug #81632 [Fbk]: Shuffled parser tokens on PHP 8.1?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237829@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: Feedback Type: Bug Package: *General Issues Operating System: Ubuntu PHP Version: 8.1Git-2021-11-17 (Git) Assigned To: cmb Block user comment: N Private report: N New Comment: https://bugs.php.net/bug.php?id=81632 Right, c02aa461268843270a6897c20ef3fb4b00d9de8a is on PHP-8.1, but not on master (it had been merged into master, though). I have been fooled by GH UI (I thought that had been fixed some time ago). Anyhow, I did a fresh build of that commit, and got the expected results. I have no idea what might be wrong. Previous Comments: ------------------------------------------------------------------------ [2021-11-17 18:14:24] contact at shivammathur dot com I have rechecked that correct branches are used. c02aa461268843270a6897c20ef3fb4b00d9de8a is also in PHP-8.1 $ git branch -a --contains c02aa461268843270a6897c20ef3fb4b00d9de8a * master remotes/origin/HEAD -> origin/master remotes/origin/PHP-8.1 remotes/origin/master ------------------------------------------------------------------------ [2021-11-17 16:50:28] cmb@php.net It seems <https://github.com/shivammathur/setup-php/issues/527> is back. <https://github.com/phpstan/phpstan-src/runs/4240473383?check_suite_focus=true#step:3:13> mentions commit c02aa461268843270a6897c20ef3fb4b00d9de8a, but that appears to be on master, not on PHP 8.1. ------------------------------------------------------------------------ [2021-11-17 16:28:26] ondrej at mirtes dot cz This is the debug code that outputs the log: https://github.com/phpstan/phpstan-src/blob/ec1ea7c50bcc35d9506e86746a0a2f46171599e7/NetteReflection.php#L307 ------------------------------------------------------------------------ [2021-11-17 16:21:20] cmb@php.net Looks good here: <https://3v4l.org/MJA67>. How do you map the token values to string representations? ------------------------------------------------------------------------ [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

« previous php.bugs (#237829) next »