HaxeFoundation / HaxeFoundation/haxe
enum/class named `Attribute` will fail at runtime with PHP 8
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
enum Attribute { // rename Attribute to anything to workaround
A;
}
class Test {
static function main() {
trace(A);
}
}
```
Runtime error with PHP 8.0.3
```
Fatal error: Uncaught Error: Call to undefined method Attribute::A() in /Users/andy/Documents/workspace/ansi/bin/php/lib/Test.php:16
Stack trace:
#0 /Users/andy/Documents/workspace/ansi/bin/php/index.php(13): Test::main()
#1 {main}
thrown in /Users/andy/Documents/workspace/ansi/bin/php/lib/Test.php on line 16
PHP Fatal error: Uncaught Error: Call to undefined method Attribute::A() in /Users/andy/Documents/workspace/ansi/bin/php/lib/Test.php:16
Stack trace:
#0 /Users/andy/Documents/workspace/ansi/bin/php/index.php(13): Test::main()
#1 {main}
thrown in /Users/andy/Documents/workspace/ansi/bin/php/lib/Test.php on line 16
Error: Command failed with error 255
```
Note that it runs fine with PHP 7.4.
Contributor guide
Assessment
This issue has not been assessed yet.