[php-src] Issue #14937: Bison parser generates different zendtokentype constants for each patch version since php 8.3.
| From: | vtsykun | Date: | Fri, 12 Jul 2024 19:14:51 +0000 |
| Subject: | [php-src] Issue #14937: Bison parser generates different zendtokentype constants for each patch version since php 8.3. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-247284@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/14937
Author: 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
<?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_