Hello
I’m working on a local server on a website using CakePHP version 5.0.7 with PHP 8.3, and I wanted to update my CakePHP version.
After running composer update, debug_kit displays an error message saying that a DebugKit plugin is already loaded.
Therefore, it’s impossible to access the site’s pages unless debugging is disabled.
Does anyone have any idea what’s happening and how to fix it ?
Any help would be greatly appreciated. Thanks in advance.
Mike
Hello Mike,
From the top of my head, check for duplicates these two places where Cake loads plugins:
See if maybe DebugKit has been duplicated by chance?
Also, since composer was involved, just read through composer.json to see if it looks right. You can also try to delete composer.lock (where the current selections are stored) and re-run composer to have it start from scratch.
This is just guessing but I hope it helps.
Hi Alex,
Thanks for your help.
I didn’t find any duplicate debug_kit files in the directories you mentioned. No issues in the vendor directory either.
I carefully examined the composer.json and composer.lock files. I don’t see anything unusual. If I replace the updated one with the old vendor folder and restore the old composer.json and composer.lock files, the site works correctly again. So the problem is there, but where? Perhaps I need to run a separate composer self-update before running a composer update ? I’ll try that.
Mike
Latest tests:
After running composer self-update, there are no problems.
After updating composer update cakephp from 5.0.7 to 5.0.11, there are no problems.
After updating composer update cakephp from 5.0.11 to 5.1.0, the error “Plugin named DebugKit is already loaded” reappears.
From memory, I removed any references to DebugKit from config/plugins.php. DebugKit loaded as long as ‘debug' => true, (in config/app_local.php)
Hi James
You’re right! I removed the reference to DebugKit in config/plugins.php and that solved my problem.
Thank you so much for your help.
Mike
In CakePHP, the DebugKit double-load started when it started auto-loading when debug is true. This means that any manual entry in config/plugins.php becomes a duplicate from 5.1 and up. The best way to fix it is to take that line out. It’s also worth looking at other plugins on major bumps; a few got the same treatment.
That’s correct. In fact, I noticed when creating a plugin with bake that the old references to other plugins were automatically removed from the plugins.php file. Thank you for your further explanation.