Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[php] PHP 8.1 compatibility #10502

Closed
cedx opened this issue Nov 25, 2021 · 3 comments
Closed

[php] PHP 8.1 compatibility #10502

cedx opened this issue Nov 25, 2021 · 3 comments
Assignees
Labels
platform-php Everything related to PHP

Comments

@cedx
Copy link
Contributor

cedx commented Nov 25, 2021

😭 PHP 8.1 has introduced some additional incompatibilities...

PHP Fatal error:  During inheritance of JsonSerializable: Uncaught ErrorException:
Return type of Array_hx::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed,
or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

This error is due to: https://wiki.php.net/rfc/internal_method_return_types
For now, it can be avoided by early adjusting the error_reporting level (in the PHP front file, for example):

\php\Boot::__hx__init();
if (version_compare(PHP_VERSION, "8.1.0", ">=")) error_reporting(error_reporting() & ~E_DEPRECATED);
// OR: if (PHP_VERSION_ID >= 80100) ...
@RealyUniqueName RealyUniqueName self-assigned this Nov 25, 2021
@RealyUniqueName RealyUniqueName added the platform-php Everything related to PHP label Nov 25, 2021
@RealyUniqueName RealyUniqueName added this to the Backlog milestone Nov 25, 2021
@RealyUniqueName
Copy link
Member

Related #9964

@RealyUniqueName
Copy link
Member

I excluded E_DEPRECATED notices from error reporting.
Also I added support for php attribues (see bb59dda) as another solution to this issue is to annotate reported methods with #[\ReturnTypeWillChange] in php code.

Closing this issue because overall compatibility with PHP 8 is tracked in #9964

@cedx
Copy link
Contributor Author

cedx commented Nov 26, 2021

@RealyUniqueName Great news! I hope to see a new release of Haxe soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-php Everything related to PHP
Projects
None yet
Development

No branches or pull requests

2 participants