While using Entity Browser widget with I would receive the a similar TypeError message. After patching, it now gives me the following error:
TypeError: key(): Argument #1 ($array) must be of type array, null given in key() (line 224 of /app/docroot/modules/contrib/lightning_media/lightning_media.module)
#0 /app/docroot/modules/contrib/lightning_media/lightning_media.module(224): key(NULL)
#1 [internal function]: lightning_media_inject_entity_browser_count(Array, Object(Drupal\Core\Form\FormState))
#2 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1083): call_user_func_array('lightning_media...', Array)
#3 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#4 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#5 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#6 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#7 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(1075): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#8 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(579): Drupal\Core\Form\FormBuilder->doBuildForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#9 /app/docroot/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('layout_builder_...', Array, Object(Drupal\Core\Form\FormState))
#10 /app/docroot/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\layout_builder\Form\UpdateBlockForm), Object(Drupal\Core\Form\FormState))
#11 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#12 /app/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#13 /app/docroot/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 /app/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#15 /app/docroot/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#16 /app/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#17 /app/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#18 /app/docroot/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /app/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /app/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /app/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /app/docroot/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /app/vendor/asm89/stack-cors/src/Asm89/Stack/Cors.php(49): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /app/docroot/modules/contrib/shield/src/ShieldMiddleware.php(270): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /app/docroot/modules/contrib/shield/src/ShieldMiddleware.php(137): Drupal\shield\ShieldMiddleware->bypass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /app/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /app/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /app/docroot/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /app/docroot/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#31 {main}