Drupal\language\LanguageNegotiator::updateConfiguration() is passed a NULL

Created on 4 May 2016, over 8 years ago
Updated 18 August 2022, over 2 years ago

I am getting a stack trace when installing module to enable language translation

The steps to reproduce

in the search box on

http://dev.drupal.co.uk/admin/modules

type 'trans' this will bring up the tree module I want to install in one step

Configuration Translation
Content Translation
Interface Translation

selecting all three and pressing install, for me caused this stack trace ( See languageStackTrace.png )

Anyways here is the error, I am looking into this but I posting early just in case someone knows the answer.

[04-May-2016 11:47:19 Europe/Berlin] TypeError: Argument 1 passed to Drupal\language\LanguageNegotiator::updateConfiguration() must be of the type array, null given, called in /XXX/drupal/core/modules/language/language.module on line 320 in /XXX/drupal/core/modules/language/src/LanguageNegotiator.php on line 292

πŸ› Bug report
Status

Closed: cannot reproduce

Version

9.3

Component
Language systemΒ  β†’

Last updated 2 days ago

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

πŸ‡¬πŸ‡§United Kingdom martin107

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • πŸ‡ΊπŸ‡ΈUnited States ccarnnia

    I came across this issue today on a D10 site.
    Not totally sure but i think this site had problems during an updb when core was upgraded last.
    i went to another healthy site and ran config export:
    drush @MYGOODSITE cex
    copied the following .yml files from MYGOODSITE's config/sync to a /tmp/bla folder:
    language.content_settings.path_alias.path_alias.yml
    language.content_settings.redirect.redirect.yml
    language.entity.en.yml
    language.entity.und.yml
    language.entity.zxx.yml
    language.mappings.yml
    language.negotiation.yml
    language.types.yml

    edit each of these files and deleted the UUID.
    and then imported them to MYBADSITE :
    drush @MYBADSITE config:import --partial --source=/tmp/bla/

    I had to run the config:import 2 times .
    1st tim it only imported negotiation.
    This fixed the issue for me.

  • πŸ‡ΊπŸ‡ΈUnited States TolstoyDotCom L.A.

    I ran into this with a copy of D11 dev that I downloaded a few weeks ago. I installed the ai module and several of its submodules at the same time, including experimental modules. I assume the issue was because of ai_translate. I only had the default language installed. The error I got was: Uncaught PHP Exception TypeError: "Drupal\\language\\LanguageNegotiator::updateConfiguration(): Argument #1 ($types) must be of type array, null given, called in /web/core/modules/language/language.module on line 321" at /web/core/modules/language/src/LanguageNegotiator.php line 306, referer: admin/modules/list/confirm-non-stable

    When I went to admin/config/regional/language/detection as #34 suggests, I got another error: Uncaught PHP Exception TypeError: "in_array(): Argument #2 ($haystack) must be of type array, null given" at /web/core/modules/language/src/Form/NegotiationConfigureForm.php line 141

    The problem is calls to $configurable = $this->languageTypes->get('configurable') and $configurable = $this->config->get('configurable') can return NULL. When $configurable is used in in_array etc it results in those errors.

    Unless that return value shouldn't ever be null and there's a more fundamental problem, it seems like the solution is to follow those calls with $configurable = $configurable ?? []; or similar.

Production build 0.71.5 2024