TypeError: Drupal\language\LanguageNegotiationMethodBase::setCurrentUser() return NULL

Created on 18 March 2022, almost 3 years ago
Updated 8 August 2024, 5 months ago

Problem/Motivation

TypeError: Drupal\language\LanguageNegotiationMethodBase::setCurrentUser() returns NULL. when using with module https://www.drupal.org/project/toolbar_language_switcher β†’

php-error staging-20950 #4 [internal function]: toolbar_language_switcher_toolbar()
php-error staging-20950 #3 /mnt/www/html/unicefv4stg/docroot/modules/contrib/toolbar_language_switcher/toolbar_language_switcher.module(15): Drupal\toolbar_language_switcher\RenderBuilder->build()
php-error staging-20950 #2 /mnt/www/html/unicefv4stg/docroot/modules/contrib/toolbar_language_switcher/src/RenderBuilder.php(77): Drupal\language\ConfigurableLanguageManager->getLanguageSwitchLinks('language_interf...', Object(Drupal\Core\Url))
php-error staging-20950 #1 /mnt/www/html/unicefv4stg/docroot/core/modules/language/src/ConfigurableLanguageManager.php(413): Drupal\language\LanguageNegotiator->getNegotiationMethodInstance('language-url')
php-error staging-20950 [17-Mar-2022 19:36:22 UTC] TypeError: Drupal\language\LanguageNegotiationMethodBase::setCurrentUser(): Argument #1 ($current_user) must be of type Drupal\Core\Session\AccountInterface, null given, called in /mnt/www/html/unicefv4stg/docroot/core/modules/language/src/LanguageNegotiator.php on line 215 in /mnt/www/html/unicefv4stg/docroot/core/modules/language/src/LanguageNegotiationMethodBase.php on line 52 #0 /mnt/www/html/unicefv4stg/docroot/core/modules/language/src/LanguageNegotiator.php(215): Drupal\language\LanguageNegotiationMethodBase->setCurrentUser(NULL)

Steps to reproduce

Enable Admin Toolbar Language Switcher
try login CMS using SSO or uli command.

Proposed resolution

Update constructor of LanguageNegotiator to add current user.

Remaining tasks

User interface changes

πŸ› Bug report
Status

Closed: cannot reproduce

Version

11.0 πŸ”₯

Component
Language systemΒ  β†’

Last updated about 15 hours ago

  • Maintained by
  • πŸ‡©πŸ‡ͺGermany @sun
Created by

πŸ‡ͺπŸ‡ΈSpain himanshu5050 Spain

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024