HaxeFoundation / HaxeFoundation/haxe

[PHP] haxe.Exception native check

Open
#12,181 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hej,

Sorry for annoying you with these exceptions but this piece of code works everywhere but in PHP it gives something wrong :
```haxe
class Err extends haxe.Exception{
public function new( o : Any ){
trace( o );
super( null, null, o );
trace( this.native );
}
}

class Test {
static function main() {
var err = new Err( true );
}
}
```
I get `true` and `true` on JS, Neko, Eval, HL but in PHP it gives that :
```
src/com/Main.hx:19: true
src/com/Main.hx:21: com\Err in /media/filt3rek/common/home/filt3rek/work/_tests/test/export/php/lib/com/Main.php:16
Stack trace:
#0 /media/filt3rek/common/home/filt3rek/work/_tests/test/export/php/index.php(14): com\Main::main()
#1 {main}
```
I think it's comming form here : https://github.com/HaxeFoundation/haxe/blob/4.3.5/std/php/_std/haxe/Exception.hx#L47
If `native` can be anything, this `&& Std.isOfType(native, Throwable` is wrong ... if I remove that check, it works fine.

Thanks for your help,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.