aws / aws-php-sns-message-validator

Amazon SNS message validation for PHP
Apache License 2.0
211 stars 53 forks source link

PHP 8.1 Compatibility #54

Closed wardtd closed 2 years ago

wardtd commented 3 years ago

Please fill out the sections below to help us address your issue.

Version of AWS SDK for PHP?

N/A

Version of Amazon SNS Message Validator for PHP?

1.6.0

Version of PHP (php -v)?

8.1rc1

What issue did you see?

PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Aws\Sns\Message::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/laravel-aws-sns/laravel-aws-sns/vendor/aws/aws-php-sns-message-validator/src/Message.php:100

Steps to reproduce

This is a run-time failure due to a signature validation error any time the method is invoked.

Additional context

We identified this issue when attempting to validate a package using the message validator against PHP 8.1rc1. We will be submitting a pull request in the future to resolve this issue.

iquito commented 2 years ago

I am also running into this with running my project on PHP 8.1, although to clarify: this is only a deprecation notice, not a run-time failure, so it is easy to ignore for now, but a fix would be appreciated.

ankurk91 commented 2 years ago

We need to add #[ReturnTypeWillChange] to those methods to suppress the errors.

stobrien89 commented 2 years ago

This should be resolved as of 1.7.0. Let us know if you have any questions!