Exception: Warning: Undefined array key "preprocess functions" Drupal\Core\Theme\Registry->mergePreprocessFunctions()

Created on 24 November 2022, over 1 year ago
Updated 26 June 2024, 4 days ago

Problem/Motivation

Got the error while testing against the bootstrap theme, 8.x-3.25

Exception: Warning: Undefined array key "preprocess functions"
Drupal\Core\Theme\Registry->mergePreprocessFunctions()() (Line: 689)

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Theme 

Last updated about 5 hours ago

Created by

🇨🇳China jungle Chongqing, China

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 smustgrave

    Could we get steps to reproduce this issue?

    Also as a bug think this will need a test case

    Thanks!

  • 🇺🇸United States johns996 Marquette, MI

    I think I ran into this issue when testing the Drupal 10.3 update on my sites. One of my sites kept generating an error on the drush updb step. Drush would generate the following error:

    > [error] TypeError: array_diff(): Argument #2 must be of type array, null given in array_diff() (line 702 of /htdocs/Drupal/web/core/lib/Drupal/Core/Theme/Registry.php) #0 /htdocs/Drupal/web/core/lib/Drupal/Core/Theme/Registry.php(702): array_diff()

    After applying the patch #2 I could get through the updb step with this single warning showing up:

     [warning] Theme hook simple_menu_icons_css_item not found.
    

    Looking through my sites I realized that the only site the error was showing up on was the one with the simple_menu_icons module enabled. So I rolled the site DB back, reverted the patch, uninstalled the module, and ran updb again. All the DB update applied and no errors were generated. I don't know if this helps with anything but I wanted to share my experience with this issue in the event is helps someone.

  • 🇺🇸United States hummeldon

    We've also encountered the same issues as outlined in #5 while testing Drupal 10.3. Patch #2 seemed to resolve the issue, but I believe the issue stems from something in the Bootstrap theme as mentioned in #1 and #2. I've experimented with switching to the core Olivero theme and the contrib Bootstrap5 theme and the issue wasn't present.

    johns996, is your team using a sub-theme based on Bootstrap? If so, that may further confirm my suspicion and likely points to this issue needing to move over there instead of in Core.

  • 🇺🇸United States johns996 Marquette, MI

    hummeldon, yes this site is using the Bootstrap 3 theme.

    After seeing your message I ran another set of tests on the site. I reset the DB again, made sure the module I thought was the culprit was enabled, and ran a drush updb. I got the same error I listed in #5 as expected. This time I kept the module installed and instead switched the default theme to Claro 10.3 and fully uninstalled the Bootstrap 3 (both my custom subtheme and the contrib theme). After changing the theme I ran drush updb and all of the database updates worked as expected. I still encountered the warning "Theme hook simple_menu_icons_css_item not found." related to the simple menu icons module but that was the same behavior I saw with the page from #2.

    It looks to me like you're right, this is a Bootstrap issue, but one that only shows up when a theme hook is not found. Hope this helps.

Production build 0.69.0 2024