COMMUNITY

Haxe makes PHP fatal about warnings, after overriding exceptions

I’ve embedded Haxe classes into an existing php website by compiling it to PHP using haxephp.

Since then all Notices & Warnings happen to be fatal, so many things are broken.

For example: count() on non irritable, or $_GET["nonexistent"] are now fatal.

The stack-trace is a Haxe style stack trace, so I do understand this has something to do with haxe overriding the exception handling.

I tried to search the PHP site about overriding exception but didn’t found anything helpful.

How can I lower the strictness and make php continue on those kinds of errors?

Asked here but no response

Here’s how Haxe overrides error handling on php:

As you can see, to disable that you can either define HAXE_CUSTOM_ERROR_HANDLER constant or setup your own error handler in your php scripts prior to inclusion of Haxe-generated php.

But keep in mind that without such warnings-to-exceptions conversion Haxe code won’t throw on null pointer access or on attempt to read a non-existent file etc. And some Haxe libraries may rely on those exceptions being thrown.

Hi Thanks

I hope to sanitize my website of all warnings, but in the meantime i couldn’t afford to break certain pages.