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

From: Date: Wed, 17 Nov 2021 16:11:23 +0000
Subject: Bug #81632 [NEW]: Shuffled parser tokens on PHP 8.1?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237822@lists.php.net to get a copy of this message
From:             ondrej at mirtes dot cz
Operating system: Ubuntu
PHP version:      8.1Git-2021-11-17 (Git)
Package:          *General Issues
Bug Type:         Bug
Bug description:Shuffled parser tokens on PHP 8.1?

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 bug report at https://bugs.php.net/bug.php?id=81632&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81632&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81632&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81632&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81632&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81632&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81632&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81632&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81632&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81632&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81632&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81632&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81632&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81632&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81632&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81632&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81632&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81632&r=mysqlcfg


Thread (9 messages)

« previous php.bugs (#237822) next »