php-debugbar: php8.1 prep: fatal error, "During inheritance of ArrayAccess: Uncaught ErrorException:"

running a quick test of latest 8.1 RC

php -v
	PHP 8.1.0RC3 (cli) (built: Sep 28 2021 21:40:07) (NTS gcc x86_64)
	Copyright (c) The PHP Group
	Zend Engine v4.1.0RC3, Copyright (c) Zend Technologies
	    with Zend OPcache v8.1.0RC3, Copyright (c), by Zend Technologies
	    with Xdebug v3.1.0beta2, Copyright (c) 2002-2021, by Derick Rethans

with

composer show | egrep -i "debugbar|laravel/framework"
	barryvdh/laravel-debugbar            v3.6.2             PHP Debugbar integration for Laravel
	laravel/framework                    v8.62.0            The Laravel Framework.
	maximebf/debugbar                    v1.17.1            Debug bar in the browser for php application
artisan info

   Symfony\Component\ErrorHandler\Error\FatalError 

  During inheritance of ArrayAccess: Uncaught ErrorException: Return type of DebugBar\DebugBar::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 /test/laravel/vendor/maximebf/debugbar/src/DebugBar/DebugBar.php:484
Stack trace:
#0 /test/laravel/vendor/maximebf/debugbar/src/DebugBar/DebugBar.php(29): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Return type of ...', '/test/l...', 484)
#1 /test/laravel/vendor/composer/ClassLoader.php(571): include('/test/l...')
#2 /test/laravel/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/test/l...')
#3 /test/laravel/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php(57): Composer\Autoload\ClassLoader->loadClass('DebugBar\\DebugB...')
#4 /test/laravel/vendor/composer/ClassLoader.php(571): include('/test/l...')
#5 /test/laravel/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile('/test/l...')
#6 /test/laravel/vendor/barryvdh/laravel-debugbar/src/ServiceProvider.php(37): Composer\Autoload\ClassLoader->loadClass('Barryvdh\\Debugb...')
#7 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(873): Barryvdh\Debugbar\ServiceProvider->Barryvdh\Debugbar\{closure}(Object(Illuminate\Foundation\Application), Array)
#8 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build(Object(Closure))
#9 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('Barryvdh\\Debugb...', Array, true)
#10 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve('Barryvdh\\Debugb...', Array)
#11 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('Barryvdh\\Debugb...', Array)
#12 /test/laravel/vendor/barryvdh/laravel-debugbar/src/ServiceProvider.php(60): Illuminate\Foundation\Application->make('Barryvdh\\Debugb...')
#13 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(767): Barryvdh\Debugbar\ServiceProvider->Barryvdh\Debugbar\{closure}(Object(Illuminate\View\Engines\EngineResolver), Object(Illuminate\Foundation\Application))
#14 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve('view.engine.res...', Array, true)
#15 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve('view.engine.res...', Array)
#16 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make('view.engine.res...', Array)
#17 /test/laravel/vendor/facade/ignition/src/IgnitionServiceProvider.php(455): Illuminate\Foundation\Application->make('view.engine.res...')
#18 /test/laravel/vendor/facade/ignition/src/IgnitionServiceProvider.php(155): Facade\Ignition\IgnitionServiceProvider->hasCustomViewEnginesRegistered()
#19 /test/laravel/vendor/facade/ignition/src/IgnitionServiceProvider.php(98): Facade\Ignition\IgnitionServiceProvider->registerViewEngines()
#20 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Facade\Ignition\IgnitionServiceProvider->boot()
#21 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#22 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#23 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#24 /test/laravel/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#25 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(914): Illuminate\Container\Container->call(Array)
#26 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(895): Illuminate\Foundation\Application->bootProvider(Object(Facade\Ignition\IgnitionServiceProvider))
#27 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(Facade\Ignition\IgnitionServiceProvider), 16)
#28 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(896): array_walk(Array, Object(Closure))
#29 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\Foundation\Application->boot()
#30 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#31 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array)
#32 /test/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()
#33 /test/laravel/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 {main}

  at vendor/maximebf/debugbar/src/DebugBar/DebugBar.php:29
     25▕  *     $debugbar->addCollector(new DataCollector\MessagesCollector());
     26▕  *     $debugbar['messages']->addMessage("foobar");
     27▕  * </code>
     28▕  */
  ➜  29▕ class DebugBar implements ArrayAccess
     30▕ {
     31▕     public static $useOpenHandlerWhenSendingDataHeaders = false;
     32▕
     33▕     protected $collectors = array();


   Whoops\Exception\ErrorException

drop back to

php -v
	PHP 8.0.11 (cli) (built: Sep 21 2021 17:07:44) ( NTS gcc x86_64 )
	Copyright (c) The PHP Group
	Zend Engine v4.0.11, Copyright (c) Zend Technologies
	    with Zend OPcache v8.0.11, Copyright (c), by Zend Technologies

, all’s good

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 12
  • Comments: 33

Most upvoted comments

Yes @Tsdjimmy : I recently upgraded my PHP version from PHP7 to PHP8… What is its solution…?

Run composer update. Let me know if it worked.

  1. Update composer.json on your laravel project. like this

{ “name”: “laravel/laravel”, “type”: “project”, “description”: “The Laravel Framework.”, “keywords”: [“framework”, “laravel”], “license”: “MIT”, “require”: { “php”: “^7.3|^8.0”, “fideloper/proxy”: “^4.4”, “fruitcake/laravel-cors”: “^2.0”, “guzzlehttp/guzzle”: “^7.0.1”, “laravel/framework”: “^8.40”, “laravel/tinker”: “^2.5” }, “require-dev”: { “facade/ignition”: “^2.5”, “fakerphp/faker”: “^1.9.1”, “laravel/sail”: “^1.0.1”, “laravel/ui”: “^3.3”, “mockery/mockery”: “^1.4.2”, “nunomaduro/collision”: “^5.0”, “phpunit/phpunit”: “^9.3.3” }, “autoload”: { “psr-4”: { “App\”: “app/”, “Database\Factories\”: “database/factories/”, “Database\Seeders\”: “database/seeders/” } }, “autoload-dev”: { “psr-4”: { “Tests\”: “tests/” } }, “scripts”: { “post-autoload-dump”: [ “Illuminate\Foundation\ComposerScripts::postAutoloadDump”, “@php artisan package:discover --ansi” ], “post-root-package-install”: [ “@php -r "file_exists(‘.env’) || copy(‘.env.example’, ‘.env’);"” ], “post-create-project-cmd”: [ “@php artisan key:generate --ansi” ] }, “extra”: { “laravel”: { “dont-discover”: [] } }, “config”: { “optimize-autoloader”: true, “preferred-install”: “dist”, “sort-packages”: true }, “minimum-stability”: “dev”, “prefer-stable”: true }

  1. run composer update

I got into dependency conflict hell but the principle of the fix was the same as most others here: upgrading.

Unfortunately, I was plagued with the error(s) here that prevented upgrading/updating in the process.

To side-step these issues, I deleted the post-autoload-dump scripts in my composer.json. I went from this:

    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    }

…to this:

    "scripts": {
        "post-autoload-dump": []
    }

Once packages were successfully updated/upgraded I re-enabled the scrips, and things worked wonderfully. 👌

Yes @Tsdjimmy : I recently upgraded my PHP version from PHP7 to PHP8… What is its solution…?

Run composer update. Let me know if it worked.

Thank you sir, It works for me

composer update don’t work for me

Did you recently upgrade your PHP version while working on the project?

Your requirements could not be resolved to an installable set of packages.

Problem 1 - maatwebsite/excel[3.1.28, …, 3.1.30] require phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0]. - maatwebsite/excel[3.1.31, …, 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, …, 1.23.0]. - maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, …, 1.23.0]. - maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, …, 1.23.0]. - maatwebsite/excel[3.1.0, …, 3.1.25] require php ^7.0 -> your php version (8.1.5) does not satisfy that requirement. - phpoffice/phpspreadsheet[1.15.0, …, 1.23.0] require ext-gd * -> it is missing from your system. Install or enable PHP’s gd extension.
- Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, …, 3.1.x-dev].

To enable extensions, verify that they are enabled in your .ini files: - C:\xampp\php\php.ini You can also run php --ini in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with --ignore-platform-req=ext-gd to temporarily ignore these required extensions.

how to resolve this issue. please help me ?

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 please solve this error

i had the same Issue too. I fixed it by changing “laravel/framework”: "8.12." to “laravel/framework”: "8.^ "

I hope this helps someone