Cannot run update.php

Created on 10 July 2024, 4 months ago

Problem/Motivation

Since 10.3 update, can not run update.php - receive this error:

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

array_diff(Array, NULL) (Line: 702)
Drupal\Core\Theme\Registry->mergePreprocessFunctions('block__system_menu_block__main', 'block', Array, Array) (Line: 677)
Drupal\Core\Theme\Registry->completeSuggestion('block__system_menu_block__main', Array) (Line: 791)
Drupal\Core\Theme\Registry->postProcessExtension(Array, Object) (Line: 161)
Drupal\bootstrap\Plugin\Alter\ThemeRegistry->alter(Array, NULL, NULL) (Line: 303)
Drupal\bootstrap\Bootstrap::alter('bootstrap_theme_registry_alter', Array, NULL, NULL) (Line: 139)
bootstrap_theme_registry_alter(Array, NULL, NULL) (Line: 458)
Drupal\Core\Theme\ThemeManager->alterForTheme(Object, 'theme_registry', Array) (Line: 433)
Drupal\Core\Theme\Registry->build() (Line: 274)
Drupal\Core\Theme\Registry->get() (Line: 88)
Drupal\Core\Utility\ThemeRegistry->initializeRegistry() (Line: 69)
Drupal\Core\Utility\ThemeRegistry->__construct('theme_registry:runtime:sub_theme', Object, Object, Array, 1) (Line: 319)
Drupal\Core\Theme\Registry->getRuntime() (Line: 141)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 66)
Drupal\Core\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'maintenance_page', Array) (Line: 76)
Drupal\Core\ProxyClass\Render\BareHtmlPageRenderer->renderBarePage(Array, Object, 'maintenance_page', Array) (Line: 205)
Drupal\system\Controller\DbUpdateController->handle('info', Object)
call_user_func_array(Array, Array) (Line: 115)
Drupal\Core\Update\UpdateKernel->handleRaw(Object) (Line: 76)
Drupal\Core\Update\UpdateKernel->handle(Object) (Line: 27)

I resolved by removing both block__system_menu_block__main.html.twig and block__system_menu_block__account.html.twig template files. Unsure of the underlying issue.

Possible solution to https://www.drupal.org/project/bootstrap/issues/3452819 🐛 Argument #9 ($kernel) must be of type ? Fixed #19.

🐛 Bug report
Status

Active

Version

3.31

Component

Theme Registry

Created by

🇳🇿New Zealand derekthatcher Christchurch

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

Merge Requests

Comments & Activities

Not all content is available!

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

  • 🇺🇸United States AaronBauman Philadelphia

    Not clear to me what the issue is either, but the suggested fix of removing the offending twig files fixed it for me as well.

    Here's a related core issue, though not clear that it's actually a core problem or how to recreate with only core: 🐛 array_diff(): Argument #2 must be of type array, null given in array_diff() (line 702 [...] core/lib/Drupal/Core/Theme/Registry.php) Postponed: needs info

    I will open a MR with the suggested fix as a temporary workaround.

  • Status changed to Needs review 4 months ago
  • 🇺🇸United States AaronBauman Philadelphia
  • Pipeline finished with Success
    4 months ago
    Total: 161s
    #222039
  • Pipeline finished with Skipped
    4 months ago
    #222126
  • First commit to issue fork.
  • 🇮🇳India akki123

    In my case, removing this file bootstrap/templates/block/block.html.twig
    resolved the update.php issue.

  • 🇮🇳India akki123

    In the end, it boils down to my custom theme hook implementation.
    customTheme_preprocess_block__BlockID()
    I removed that and update.php works.

  • Status changed to Fixed 3 months ago
  • 🇳🇿New Zealand RoSk0 Wellington

    Marking as fixed as this was released in the 8.x-3.32 and fixed the issue for me - tested on the latest Drupal core 10.3.2.

  • Remove file generate error : Twig\Error\LoaderError: Template "themes/contrib/bootstrap/templates/block/block--system-menu-block--main.html.twig" is not defined.

  • Status changed to Active 3 months ago
  • 🇺🇸United States shelane
  • 🇦🇷Argentina cesarmiquel

    I also experienced this issue and noticed the problem was the same as in comment #8: by commenting out the theme__preprocess_block__simple_block(&$variables) in the custom theme, rebuilding registry and I was able to run the update without problems. I don't think deleting templates is the correct way to fix this. I would recommend looking into your .theme file.

  • 🇬🇧United Kingdom alexj12

    Encountered this issue after upgrading a site from 10.2.x to 10.3.x which included bumping this theme to 3.32.

    Even down to trying out the previous advice 'In my case, removing this file bootstrap/templates/block/block.html.twig
    resolved the update.php issue.' which worked, but I wasn't too keen on that as a permanent fix.

    I'm entirely sure that all composer commands were run successfully when the issue occurred, but I simply re-ran `composer require 'drupal/bootstrap:^3.32', composer re-evaluated and regenerated a number of autoload files and following that database updates ran successfully. The issue seems to be resolved for the site that was affected.

    This might sound like I missed something, and maybe I did, but I haven't been able to track down what. May just be worth a try as a first pass if anyone else runs into this issue.

Production build 0.71.5 2024