Uncaught Error: Object of class UnwindExit - During inheritance of ArrayAccess

So., 12/06/2022 - 13:38
Body

Here we go again full crash after an update

 

[Sun Jun 12 12:37:25.606914 2022] [php:warn] [pid 2061] [client 127.0.0.1:53926] PHP Warning:  Uncaught Error: Object of class UnwindExit could not be converted to string in /srv/http/php_scripte/afn/app/apis/amazon_api/amazon_sdk/src/com/amazon/paapi5/v1/SearchItemsRequest.php:29\nStack trace:\n#0 /s>
[Sun Jun 12 12:37:25.606929 2022] [php:error] [pid 2061] [client 127.0.0.1:53926] PHP Fatal error:  During inheritance of ArrayAccess: Uncaught  in /srv/http/php_scripte/afn/app/apis/amazon_api/amazon_sdk/src/com/amazon/paapi5/v1/SearchItemsRequest.php on line 29, referer: http://dev.afn.com/js-widget
[Sun Jun 12 12:37:25.606984 2022] [php:notice] [pid 2061] [client 127.0.0.1:53926] Fatal error: During inheritance of ArrayAccess: Uncaught , referer: http://dev.afn.com/js-widget
 

Example Error

Fatal error: During inheritance of ArrayAccess: Uncaught think\exception\ErrorException: Return type of think\Container::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 /www/wwwroot/pic/thinkphp/library/think/Container.php:579 Stack trace: #0 /www/wwwroot/pic/thinkphp/library/think/Container.php(48): think\Error::appError() #1 /www/wwwroot/pic/thinkphp/library/think/Loader.php(411): include('...') #2 /www/wwwroot/pic/thinkphp/library/think/Loader.php(132): think\__include_file() #3 /www/wwwroot/pic/public/index.php(23): think\Loader::autoload() #4 {main} in /www/wwwroot/pic/thinkphp/library/think/Container.php on line 48

 

Ursache: Update auf php 8.1

https://php.watch/versions/8.1/internal-method-return-types

 

Solutions

https://board.phpbuilder.com/d/10403143-solved-81-warning-re-return-type-of-inherited-method/5

 

Lösung!

Adde die internen return types. Beispiel 

  1. public function offsetUnset($offset) : void { ... }