Problem/Motivation
Post update system_post_update_add_langcode_to_all_translatable_config(&$sandbox = NULL) is clearing langcode from config system.site
// If this config contains any elements (at any level of nesting) which
// are translatable, but the config hasn't got a langcode, assign one. But
// if nothing in the config structure is translatable, the config shouldn't
// have a langcode at all.
if ($typed_config->hasTranslatableElements()) {
if ($config->get('langcode')) {
continue;
}
$config->set('langcode', $default_langcode);
}
else {
if (!array_key_exists('langcode', $config->get())) {
continue;
}
$config->clear('langcode');
}
$config->save();
But below code is trying to fetch langcode from system.site config which conflicting with above post update.
// Store the default language values on the container. This is so that the
// default language can be configured using the configuration factory. This
// avoids the circular dependencies that would created by
// \Drupal\language\LanguageServiceProvider::alter() and allows the default
// language to not be English in the installer.
$default_language_values = Language::$defaultValues;
if ($system = $this->getConfigStorage()->read('system.site')) {
if ($default_language_values['id'] != $system['langcode']) {
$default_language_values = ['id' => $system['langcode']];
}
}
[warning] Undefined array key "langcode" DrupalKernel.php:1395
[warning] Undefined array key "langcode" DrupalKernel.php:1396
Steps to reproduce
- Upgrade Drupal core from 10.2.3 to 10.3.10
- Execute database updates
- Run any drush command ex: drush cr and observe warning Undefined array key "langcode" DrupalKernel.php
Proposed resolution
Check if langcode is present in system.site config in DrupalKernel.php
(or)
Clean up the code which is fetching langcode if not required.