HaxeFoundation / HaxeFoundation/haxe

[PHP] class ErrorException conflict with php's native ErrorException

Open
#12,048 3 comments 0 reactions 0 assignees View on GitHub
platform-php
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

I think there is a conflict with php's native **ErrorException** class becasue this compiles fine but fails on runtime :
```haxe
class ErrorException extends haxe.Exception{
public function new(msg:String){
super(msg);
}
}
class Main{
static function main(){
var e = new ErrorException("error");
trace(e.details());
}
}
```
Gives that at runtime :
```
PHP Fatal error: Uncaught Error: Call to undefined method ErrorException::details() in /test/bin/lib/Main.php:18
Stack trace:
#0 /test/bin/index.php(13): Main::main()
#1 {main}
thrown in /test/bin/lib/Main.php on line 18
```
I think there is nothing to do here but to be aware to not use class name's that already exist on specific plateforms... :/

Contributor guide

Open the contributing guide

Research direction

Start with the PHP target output shown in /test/bin/lib/Main.php and reproduce the minimal ErrorException example. Investigate how the generated class name conflicts with PHP's native ErrorException; done would require either resolving the runtime behavior or documenting the platform limitation, neither of which is specified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.