Problem/Motivation

Ealier this month, we just upgraded Drupal from version 10 to version 11( the latest minor version at that time). I didn't checked website at that time, because this is local dev site. Today I launched the localhost and found that some of admin pages has Error messages above contents of the pages that should be debug mode things.
The messages are like bellow:
Error message
Warning: Undefined array key "bootstrap_styles" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "ckeditor5_plugin_pack" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "ckeditor5_plugin_pack" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "ckeditor5_premium_features" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "ckeditor5_premium_features" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "drupal" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "drupal" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "google_tag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "google_tag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "layout_builder_blocks" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "layout_builder_blocks" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "layout_builder_styles" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "layout_builder_styles" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "media_library_form_element" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "media_library_form_element" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "metatag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "metatag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "password_policy" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "password_policy" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "schema_metatag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "schema_metatag" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "token" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "token" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "views_infinite_scroll" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "views_infinite_scroll" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).
Warning: Undefined array key "views_slideshow" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}() (line 83 of core/modules/locale/src/LocaleProjectRepository.php).

This Error message is shown at some specific pages like below:
http://localhost/admin/config
http://localhost/admin/reports/status
http://localhost/admin/reports/translations (but not shown at http://localhost/admin/reports)

And /admin/reports/translations page says "All translations up to date."

I have already tried drush cr.
vendor/bin/drush locale:check command can make sure the existance of things listed on the Error message.
vendor/bin/drush php:eval "print_r(\Drupal::keyValue('update_available_release')->getAll());" command returns blank array.

AI I consulted says it should be bug of Drupal.

Any advise?

Steps to reproduce

This looks like locale and translation issue, so I recommend setting locale to non-English language (mine is Japanese).
Upgrade Drupal from 10.5.10 to 11.4.1. While upgrading them, composer conflict highly possibly occurs, so delete drush before upgrade and install it separately after upgrade.
Visit website and open http://localhost/admin/reports/status then you may found LocaleProjectRepository warning things.

Proposed resolution

Warings should be deleted from Admin panels.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3612028

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lionsea created an issue. See original summary.

a.hassan made their first commit to this issue’s fork.

a.hassan changed the visibility of the branch 3612028-having-undefined-array to hidden.

lionsea’s picture

And I don't know how to hide this warnings from UI. I set "Error messages to display" to none at Logging and errors page, also set $config['system.logging']['error_level'] = 0; at settings.php of dev site.

cilefen’s picture

Title: Having Undefined array key warnings after upgrading to Drupal 11 (trigger should be LocaleProjectRepository.php). » Warning: Undefined array key "bootstrap_styles" in Drupal\locale\LocaleProjectRepository->Drupal\locale\{closure}()
Version: 11.4.x-dev » main
Component: base system » locale.module
Issue tags: -translation, -locale
nicxvan’s picture

Status: Active » Postponed (maintainer needs more info)

Did you run database updates after updating?

This update should have cleared that out as far as I can recall.

lionsea’s picture

@nicxvan
Yes I did, but I forgot that my exvironment has only mysql 5.7.39, so I can run drush updatadb but with warnings. Then I installed drupal/mysql57, so now drush updatadb returns only " [success] No pending updates." line.
I have still same issue at the pages of admin website.

lionsea’s picture

For information, our hardware and OS is not compatible with mydql version 8. Due to certain circumstances, we do not plan to upgrade the hardware until a year from now. However, support for Drupal 10 ends this year. Therefore, we plan to address this issue using modules in the meantime.

v.hilkov’s picture

StatusFileSize
new1.16 KB

I also encountered this issue after upgrading one of websites to 11.4.4 I didn't had this warning during local development, only after I deployed it to test server. Couldn't find myself real reason for this, so I asked claude to find it, it told that happens because reading from an array while it is being sorted in place is undefined behaviour in PHP and can throw intermittent "Undefined array key" warnings. So I did patch that pre-computes weights in LocaleProjectRepository. Don't know if this is right fix or I just hide real problem but after I applied this patch warnings are now disappeared. I attached patch as well.

lionsea’s picture

Hi, I updated the same site from 10.5.10 to 11.4 (it's 11.4.4 this time) again, and I had the same issue. Then I uploaded the website to prod site, then the warnings disappeared there. I still don't know the reason.

gaëlg’s picture

Status: Postponed (maintainer needs more info) » Needs review

I ran into the same bug. I had already run the database update. Patch #9 fixed the bug.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update, +Needs tests

Fixes need to be in MRs for review please.