Not a bug Deprecated: Return type of XF\App::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool

ZixDev

Member
Affected version
2.2.8
I'm using PHP 8.1.0
Code:
Deprecated: Return type of XF\App::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 /Users/zix/Documents/www/xf2/src/XF/App.php on line 2398

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: [E_DEPRECATED] Return type of XF\DataRegistry::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 /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php:240 Stack trace: #0 /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php(10): XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/Users/zix/Docu...', 240) #1 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(480): include('/Users/zix/Docu...') #2 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile('/Users/zix/Docu...') #3 /Users/zix/Documents/www/xf2/src/XF/App.php(717): Composer\Autoload\ClassLoader->loadClass('XF\\DataRegistry') #4 /Users/zix/Documents/www/xf2/src/XF/Container.php(30): XF\App->XF\{closure}(Object(XF\Container)) #5 /Users/zix/Documents/www/xf2/src/XF/App.php(2537): XF\Container->offsetGet('registry') #6 /Users/zix/Documents/www/xf2/src/XF/App.php(1899): XF\App->registry() #7 /Users/zix/Documents/www/xf2/src/XF/App.php(1887): XF\App->preLoadData(Array) #8 /Users/zix/Documents/www/xf2/src/XF/Admin/App.php(43): XF\App->setup(Array) #9 /Users/zix/Documents/www/xf2/src/XF.php(485): XF\Admin\App->setup(Array) #10 /Users/zix/Documents/www/xf2/src/XF.php(508): XF::setupApp('XF\\Admin\\App') #11 /Users/zix/Documents/www/xf2/admin.php(13): XF::runApp('XF\\Admin\\App') #12 {main} in /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php on line 10

Warning: Uncaught ErrorException: [E_DEPRECATED] Return type of XF\DataRegistry::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 /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php:240 Stack trace: #0 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(480): XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/Users/zix/Docu...', 240) #1 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(480): include() #2 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile('/Users/zix/Docu...') #3 /Users/zix/Documents/www/xf2/src/XF/App.php(983): Composer\Autoload\ClassLoader->loadClass('XF\\Error') #4 /Users/zix/Documents/www/xf2/src/XF/Container.php(30): XF\App->XF\{closure}(Object(XF\Container)) #5 /Users/zix/Documents/www/xf2/src/XF/App.php(2690): XF\Container->offsetGet('error') #6 /Users/zix/Documents/www/xf2/src/XF/App.php(2356): XF\App->error() #7 /Users/zix/Documents/www/xf2/src/XF.php(236): XF\App->logException(Object(ErrorException), true) #8 [internal function]: XF::handleFatalError() #9 {main} thrown in /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php on line 240

Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: [E_DEPRECATED] Return type of XF\DataRegistry::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 /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php:240 Stack trace: #0 /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php(10): XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/Users/zix/Docu...', 240) #1 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(480): include('/Users/zix/Docu...') #2 /Users/zix/Documents/www/xf2/src/vendor/composer/ClassLoader.php(346): Composer\Autoload\includeFile('/Users/zix/Docu...') #3 /Users/zix/Documents/www/xf2/src/XF/App.php(717): Composer\Autoload\ClassLoader->loadClass('XF\\DataRegistry') #4 /Users/zix/Documents/www/xf2/src/XF/Container.php(30): XF\App->XF\{closure}(Object(XF\Container)) #5 /Users/zix/Documents/www/xf2/src/XF/App.php(2537): XF\Container->offsetGet('registry') #6 /Users/zix/Documents/www/xf2/src/XF/App.php(1899): XF\App->registry() #7 /Users/zix/Documents/www/xf2/src/XF/App.php(1887): XF\App->preLoadData(Array) #8 /Users/zix/Documents/www/xf2/src/XF/Pub/App.php(93): XF\App->setup(Array) #9 /Users/zix/Documents/www/xf2/src/XF.php(485): XF\Pub\App->setup(Array) #10 /Users/zix/Documents/www/xf2/src/XF.php(508): XF::setupApp('XF\\Pub\\App') #11 /Users/zix/Documents/www/xf2/index.php(20): XF::runApp('XF\\Pub\\App') #12 {main} in /Users/zix/Documents/www/xf2/src/XF/DataRegistry.php on line 10
 
Those methods should already have the \ReturnTypeWillChange attribute set as of XF 2.2.8.

Are these errors persistent or could they have occurred as one-offs during/preceding the upgrade?
 
I upgraded to XF 2.2.8 when using PHP 8.0.13, there were no errors.
After that, I upgraded PHP to 8.1.0, then go to forum index and get its errors.
 
If you're able to access the file health check it might be worth verifying all files have the expected contents. Or, failing that, re-download XF and overwrite the files.
 
Top Bottom