Skip to content

Bison parser generates different zendtokentype constants for each patch version since php 8.3.Β #14937

Open
@vtsykun

Description

@vtsykun

Description

Hi, I noticed that since PHP 8.3 the value of T_* constants changes for each patch version. For example, if I'll use token_get_all and cache or serialize returning result I can got unexpected behavior.

https://3v4l.org/8L2eX

<?php

$text = <<<TXT
<?php

namespace AAA;

require_once '/tmp/dev2/t4.php';
class AAA {
}

\$class = new AAA();
TXT;

$tokens = token_get_all($text);

foreach ($tokens as $token) {
    echo json_encode($token) . "\n";
}

For example
T_STRING constant is 313 for 8.3.0, 8.3.2, 8.3.4, 8.3.7, 8.3.9 versions.
T_STRING constant is 262 for 8.3.1, 8.3.3, 8.3.5 - 8.3.6, 8.3.8 versions.

However for 8.1, 8.2 there are not changes between php patch versions.

PHP Version

8.3

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions