Open evmorris94 opened 3 months ago
We have the same problem. As a workaround, we run after deployment:
composer require jenssegers/model:1.5.2
A pretty dirty workaround, because we don't load the package directly in the composer.json, but instead load it from another package that is installed directly from the composer.json.
Of course it would be great if this problem could be fixed, otherwise we will have to add this package with the version information separately in the composer.json from now on.
I have the same problem.
Declaration of Jenssegers\Model\Model::offsetExists(Jenssegers\Model\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Declaration of Jenssegers\Model\Model::offsetExists(Jenssegers\Model\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) at /app/vendor/jenssegers/model/src/Model.php:11) [stacktrace]
I'm encountering this issue when using:
https://github.com/mikebronner/laravel-caffeine
Could this be resolved by setting the appropriate php version so composer drops down to 1.5.2 for <8.1?
Our team has a package that uses jenssegers/model. A week ago, Test tier deployments of OUR final release versions ran fine. Those deployments picked up jenssegers/model version 1.5.2 in composer.
Today, the identical application release code was deployed to our Stage tier servers and failed with the following message:
PHP Fatal error: Declaration of Jenssegers\Model\Model::offsetExists(Jenssegers\Model\mixed $offset): bool must be compatible with ArrayAccess::offsetExists($offset) in /home/cebs/apps/php/feed-analysis/releases/20240730081849/vendor/jenssegers/model/src/Model.php on line 866
. Version 1.5.3 of Jenssegers/model was picked by composer in this deployment.Our servers are currently running PHP 7.4.33. We are upgrading (very soon) to PHP 8.3, but we are not quite there yet.
THIS PR has the breaking change: https://github.com/sasha-b-a/model/commit/354187dcb1459fb4f2f68f0344d47f0365b3fa18. Specifically the ArrayAccess PHP interface seems to be the culprit. In https://www.php.net/manual/en/class.arrayaccess.php the method signatures match what your PR implemented, and indicate that the interface has been around since PHP 5. However, I think the exact internal PHP signature for the return type changed (became more explicit) for the ArrayAccess methods between PHP 7 and 8. Your updated override signature in version 1.5.3 seems to NOT be backward compatible with PHP < 8.x.
I have tested the same logic on our PHP 8.3-enabled server and version 1.5.3 of this package seems to work fine there.
It seems to me that for version 1.5.3.1 or later of this package, you may need to update composer.json to only be valid for Laravel 9 and greater, since that's the first version of Laravel that MUST run on PHP 8.x or later. This should effectively resolve this issue, except for the already-released 1.5.3 tag.