Search code examples
phplaravelcpanelphp-8.1

Laravel issue after upgrade host to php 8.1


Below is the code after the change, the version to PHP 8.1 in host other laravel websites are worked after `composer update.

PHP 8.1.1 (cli) (built: Dec 15 2021 04:17:42) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.1, Copyright (c) Zend Technologies

this is the error log :

@php artisan package:discover --ansi

Deprecated: Return type of Illuminate\Container\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 /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1270

Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1281

Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1293

Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1306

Deprecated: Return type of Illuminate\Config\Repository::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/xyz/example.com/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 141

Deprecated: Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 152

Deprecated: Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value):void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 164

Deprecated: Return type of Illuminate\Config\Repository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/xyz/example.com/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 175

In Collection.php line 11:

 During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with Arra
 yAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in 

Please give me a solution to solve this problem.


Solution

  • I resolve the problem with the upgrade laravel from 7 to 8