php-debugbar
php-debugbar copied to clipboard
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
- 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 }
- run composer update
Did you recently upgrade your PHP version while working on the project?
Yes @Tsdjimmy : I recently upgraded my PHP version from PHP7 to PHP8.. What is its solution..?
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.
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
You are welcome, Sir. @Zeon8985Army
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.
It worked. Thank You.
- 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 }
- run composer update
@AhmadSudirman7 thanks, It is works for me
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 please solve this error
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 please solve this error
Share your error messages
- 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 }
2. run composer update
thankyou
My whole problem was that my Laravel version was ^8.0, then I changed for Laravel ^8.4 and I was golden.
Thanks everyone for the great help
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. 👌
composer update don't work for me
i had the same Issue too. I fixed it by changing "laravel/framework": "8.12." to "laravel/framework": "8.^ "
I hope this helps someone
Is composer update the best fix?
During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should ei
ther be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to te
mporarily
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 ?
- 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 }
- run composer update
this works for me
Reference
maturnuwun mas
Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in /home/joestack/Documents/project2022/tudirichweb/app/Exceptions/Handler.php on line 33 PHP Fatal error: Uncaught ReflectionException: Class "App\Exceptions\Handler" does not exist in /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php:877 Stack trace: #0 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(877): ReflectionClass->__construct() #1 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build() #2 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve() #3 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(296): Illuminate\Foundation\Application->resolve() #4 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(873): Illuminate\Container\Container->Illuminate\Container{closure}() #5 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build() #6 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve() #7 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve() #8 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make() #9 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\Foundation\Application->make() #10 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(185): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() #11 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(171): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole() #12 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(209): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() #13 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() #14 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [App\Exceptions\Handler] does not exist. in /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php:879 Stack trace: #0 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build() #1 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve() #2 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(296): Illuminate\Foundation\Application->resolve() #3 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(873): Illuminate\Container\Container->Illuminate\Container{closure}() #4 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(758): Illuminate\Container\Container->build() #5 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(851): Illuminate\Container\Container->resolve() #6 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Foundation\Application->resolve() #7 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(836): Illuminate\Container\Container->make() #8 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\Foundation\Application->make() #9 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(185): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() #10 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(171): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole() #11 /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(209): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() #12 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() #13 {main} thrown in /home/joestack/Documents/project2022/tudirichweb/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 879 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
am getting this error
trying to update composer Problem 1 - Root composer.json requires php ^7.1.3 but your php version (8.1.6) does not satisfy that requirement. Problem 2 - laravel/framework[v5.8.0, ..., 5.8.x-dev] require php ^7.1.3 -> your php version (8.1.6) does not satisfy that requirement. - Root composer.json requires laravel/framework 5.8.* -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev].
], "post-root-package-install": [ "@php -r "file_exists('.env') || copy('.env.example', '.env');"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi"
It's work for me, thanks
Here is what worked for me PHP Issue Laravel
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.
This works!
thanks
Awesome!
I updated the composer but I am still getting this error, And This is my error when i am running php artisan serve
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::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 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php:1443
Stack trace:
#0 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php(13): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Return type of ...', 'E:\xampp\htdocs...', 1443)
#1 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\composer\ClassLoader.php(571): include('E:\xampp\htdocs...')
#2 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('E:\xampp\htdocs...')
#3 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php(15): Composer\Autoload\ClassLoader->loadClass('Illuminate\Supp...')
#4 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(89): collect(Array)
#5 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config('aliases')
#6 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
#7 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(237): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap(Object(Illuminate\Foundation\Application))
#8 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 E:\xampp\htdocs\Laravel\AdminLudoLaravel\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main} in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php on line 13
PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Collection" not found in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php:15
Stack trace:
#0 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ReflectsClosures.php(24): collect(Array)
#1 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ReflectsClosures.php(44): Illuminate\Foundation\Exceptions\ReportableHandler->closureParameterTypes(Object(Closure))
#2 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\ReportableHandler.php(62): Illuminate\Foundation\Exceptions\ReportableHandler->firstClosureParameterType(Object(Closure))
#3 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(234): Illu#4 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(88): Illuminate\Foundation\Exceptions\Handler->report(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#5 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#6 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#7 {main}
thrown in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php on line 15
PS E:\xampp\htdocs\Laravel\AdminLudoLaravel> php artisan --version
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::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 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php:1443
Stack trace:
#0 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php(13): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Return type of ...', 'E:\xampp\htdocs...', 1443)
#1 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\composer\ClassLoader.php(571): include('E:\xampp\htdocs...')
#2 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\composer\ClassLoader.php(428): Composer\Autoload\includeFile('E:\xampp\htdocs...')
#3 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php(15): Composer\Autoload\ClassLoader->loadClass('Illuminate\Supp...')
#4 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(89): collect(Array)
#5 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config('aliases')
#6 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
#7 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(237): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap(Object(Illuminate\Foundation\Application))
#8 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 E:\xampp\htdocs\Laravel\AdminLudoLaravel\artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main} in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\Collection.php on line 13
PHP Fatal error: Uncaught Error: Class "Illuminate\Support\Collection" not found in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php:15
Stack trace:
#0 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ReflectsClosures.php(24): collect(Array)
#1 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ReflectsClosures.php(44): Illuminate\Foundation\Exceptions\ReportableHandler->closureParameterTypes(Object(Closure))
#2 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\ReportableHandler.php(62): Illuminate\Foundation\Exceptions\ReportableHandler->firstClosureParameterType(Object(Closure))
#3 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(234): Illuminate\Foundation\Exceptions\ReportableHandler->handles(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#4 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(88): Illuminate\Foundation\Exceptions\Handler->report(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#5 E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(130): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#6 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#7 {main}
thrown in E:\xampp\htdocs\Laravel\AdminLudoLaravel\vendor\laravel\framework\src\Illuminate\Collections\helpers.php on line 15
error after composer update cmd - @php artisan package:discover --ansi
In Collection.php line 11:
During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::off setExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel \framework\src\Illuminate\Support\Collection.php:1349 Stack trace: #0 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'R eturn type of ...', 'C:\xampp\htdocs...', 1349) #1 C:\xampp\htdocs\Legal251-EP-Lara\vendor\composer\ClassLoader.php(582): include('C:\xampp\htdocs...') #2 C:\xampp\htdocs\Legal251-EP-Lara\vendor\composer\ClassLoader.php(433): Composer\Autoload{closure}('C:\xampp\htdocs...') #3 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\helpers.php(110): Composer\Autoload\ClassLoader->loadClass('Illuminate\Supp...') #4 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(130): collect(Array) #5 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(106): Illuminate\Foundation\PackageManifest->build() #6 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(89): Illuminate\Foundation\PackageManifest->getManifest() #7 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config('aliases') #8 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases() #9 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap(Object (Illuminate\Foundation\Application)) #10 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array) #11 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap() #12 C:\xampp\htdocs\Legal251-EP-Lara\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Con sole\Output\ConsoleOutput)) #13 {main}
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::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 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\Collection.php:1349 Stack trace: #0 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Return type of ...', 'C:\xampp\htdocs...', 1349) #1 C:\xampp\htdocs\Legal251-EP-Lara\vendor\composer\ClassLoader.php(582): include('C:\xampp\htdocs...') #2 C:\xampp\htdocs\Legal251-EP-Lara\vendor\composer\ClassLoader.php(433): Composer\Autoload{closure}('C:\xampp\htdocs...') #3 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\helpers.php(110): Composer\Autoload\ClassLoader->loadClass('Illuminate\Supp...') #4 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(130): collect(Array) #5 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(106): Illuminate\Foundation\PackageManifest->build() #6 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(89): Illuminate\Foundation\PackageManifest->getManifest() #7 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config('aliases') #8 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases() #9 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(230): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap(Object(Illuminate\Foundation\Application)) #10 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array) #11 C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap() #12 C:\xampp\htdocs\Legal251-EP-Lara\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #13 {main} in C:\xampp\htdocs\Legal251-EP-Lara\vendor\laravel\framework\src\Illuminate\Support\Collection.php on line 11 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
The issue is caused by the incompatible versions of PHP and Laravel. Laravel 7 and lower don’t support PHP 8.1 (which comes with Ubuntu 22.04).