#Upgrade to v11: Undefined array key "items"

1 messages · Page 1 of 1 (latest)

proven stream
#

When upgrading to Laravel v11 I have followed the upgrade guide but am getting a weird and wonderful error. My Pest v2 (and I tried v3) tests are returning a JSON body of:

   array (
     'exception' => 'ErrorException',
     'message' => 'Undefined array key "items"',

This is happening when I return return CertificateResource::make($certificate); from the controller, but its nothing to do with the resource (returning an empty array doesnt work).

Removing \Illuminate\Routing\Middleware\SubstituteBindings::class, from Kernel.php $middlewareGroups api fixes it.

I dontk now what SubstituteBindings does or why we had it, but if it needs to be removed to work this may well need to be added to the upgrade guide so other people wont spend 2 hours trying to debug what the heck is going on trying random things one thing at a time. 🤣

Thank you for all the hard work!

worn pier
#

most of the boilerplate code such as Kernel.php that existed before Laravel 11 has been moved. While it says in the docs (i havent tried it) that old folder structure still works for backwards compatibility i would strongly advise againts it for the sole reason that it creates things like this. Its not that laravel has some problems in it, its just that human error is alot easier which is your case.

if your codebase is not huge just create an empty laravel 11 project and move your codebase inside that's much cleaner and that way you will be able to migrate to laravel 12 if you want to at a later stage.

frozen geode
frozen geode
worn pier
frozen geode
#

"and that way you will be able to migrate to laravel 12 if you want to at a later stage", this comes across as "you wont be able to move to laravel 12 unless you migrate folder structure"

worn pier
#

yeah they won't give upgrade guide from laravel 10 to 12, they will give it as from 11 to 12. you are trying so hard to make a case for yourself when there is none. i never meet this kind of obnoxious people in real life only in the internet...

#

so weird

frozen geode
worn pier
#

yeah sure whatever