Fix TypeError: gin_lb_css_alter(): Argument #3 ($language) must be of type Drupal\Core\Language\LanguageInterface, null given

Created on 5 August 2024, 3 months ago

Problem/Motivation

Gin Layout Builder is throwing this WSOD error message after an upgrade from 1.0.0-beta16 to 1.0.0-rc6, affecting the entire website, even pages using the frontend theme:

The website encountered an unexpected error. Please try again later.
TypeError: gin_lb_css_alter(): Argument #3 ($language) must be of type Drupal\Core\Language\LanguageInterface, null given, called in /var/www/web/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 562 in gin_lb_css_alter() (line 32 of modules/contrib/gin_lb/gin_lb.module).
gin_lb_css_alter(Array, Object, NULL) (Line: 562)
Drupal\Core\Extension\ModuleHandler->alter('css', Array, Object) (Line: 159)
Drupal\Core\Asset\AssetResolver->getCssAssets(Object, ) (Line: 311)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAssetLibraries(Object, Array) (Line: 157)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 202)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 190)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

  • Drupal 9.5.11
  • Gin LB version 1.0.0-rc6

Proposed resolution

Gin sometimes gets an empty argument for the $language variable. We should probably make the code more flexible to accept a null language variable.

Remaining tasks

--

User interface changes

The changes being applied shouldn't have any interface changes.

API changes

--

Data model changes

--

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇧🇷Brazil mabho Rio de Janeiro, RJ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024