core icon indicating copy to clipboard operation
core copied to clipboard

Incompatibility with PHP 8.1 in v4.0.0

Open ltrk2 opened this issue 1 year ago • 4 comments

API Platform version(s) affected: 4.0.0

Description
According to the requirement at Packagist, 4.0.0 is supposed to be compatible with PHP 8.1.0+. However, the use of a language feature (https://wiki.php.net/rfc/readonly_classes) supported in PHP 8.2+ introduced in https://github.com/api-platform/core/commit/7110dc665bde47b15dcfe8b1e3198427f8a78938 seems to have broken this, because I get the following error when trying to execute on top of PHP 8.1.29:

Parse error: syntax error, unexpected token "readonly", expecting "abstract" or "final" or "class" in vendor/api-platform/core/src/Hydra/Serializer/HydraPrefixNameConverter.php on line 20

How to reproduce
I'll follow-up with a simple reproduction shortly.

ltrk2 avatar Sep 19 '24 12:09 ltrk2

My bad, we wanted to support php 8.2 only for v4.0.

soyuka avatar Sep 19 '24 13:09 soyuka

@soyuka thank you very much for your quick response! I see that you've also pulled the release, which is great.

ltrk2 avatar Sep 19 '24 17:09 ltrk2

@soyuka the v4.0.0 release seems to be back on Packagist. Was this intentional by any chance? If one was using PHP 8.1, running composer install api-platform/core would install this incompatible version.

ltrk2 avatar Sep 20 '24 12:09 ltrk2

It also results in renovate to suggest an update, which fails with an error.

lazka avatar Sep 24 '24 08:09 lazka

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 23 '24 08:11 stale[bot]

It seems that v4.0.0 on Packagist now requires PHP 8.2 as originally intended, so we can definitely close this one.

Thanks for addressing the issue!

ltrk2 avatar Nov 23 '24 15:11 ltrk2