Breaks update.php in D11

Created on 13 January 2025, about 1 month ago

Problem/Motivation

After installing the module on a fresh D11 I get a notification that something (nagios, it turns out) has a database update that hasn't run yet. So I click the link to go to update.php to resolve this, and I get a WSOD.

This error appears in the log:

[Mon Jan 13 22:23:41.036071 2025] [php:notice] [pid 211422] [client 127.0.0.1:45432] Drupal\\Core\\DependencyInjection\\ContainerNotInitializedException: \\Drupal::$container is not initialized yet. \\Drupal::setContainer() must be called with a real container. in /srv/www/drupal/drupal/public/core/lib/Drupal.php on line 169 #0 /srv/www/drupal/drupal/public/core/lib/Drupal.php(414): Drupal::getContainer()\n#1 /srv/www/drupal/drupal/public/modules/contrib/nagios/src/Controller/StatuspageController.php(192): Drupal::config()\n#2 /srv/www/drupal/drupal/public/modules/contrib/nagios/nagios.module(22): Drupal\\nagios\\Controller\\StatuspageController::setNagiosStatusConstants()\n#3 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/Hook/HookCollectorPass.php(184): include_once('...')\n#4 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/Hook/HookCollectorPass.php(147): Drupal\\Core\\Hook\\HookCollectorPass->collectModuleHookImplementations()\n#5 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/Hook/HookCollectorPass.php(78): Drupal\\Core\\Hook\\HookCollectorPass::collectAllHookImplementations()\n#6 /srv/www/drupal/drupal/protected/drupal/vendor/symfony/dependency-injection/Compiler/Compiler.php(73): Drupal\\Core\\Hook\\HookCollectorPass->process()\n#7 /srv/www/drupal/drupal/protected/drupal/vendor/symfony/dependency-injection/ContainerBuilder.php(814): Symfony\\Component\\DependencyInjection\\Compiler\\Compiler->compile()\n#8 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/DrupalKernel.php(1380): Symfony\\Component\\DependencyInjection\\ContainerBuilder->compile()\n#9 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/DrupalKernel.php(899): Drupal\\Core\\DrupalKernel->compileContainer()\n#10 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/Update/UpdateKernel.php(42): Drupal\\Core\\DrupalKernel->initializeContainer()\n#11 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/DrupalKernel.php(505): Drupal\\Core\\Update\\UpdateKernel->initializeContainer()\n#12 /srv/www/drupal/drupal/public/core/lib/Drupal/Core/Update/UpdateKernel.php(65): Drupal\\Core\\DrupalKernel->boot()\n#13 /srv/www/drupal/drupal/public/update.php(27): Drupal\\Core\\Update\\UpdateKernel->handle()\n#14 {main}, referer: http://localhost/drupal/public/admin/reports/status

Steps to reproduce

1. Install Drupal 11
2. Install nagios
3. Go to /update.php
4. Observe error

Proposed resolution

It looks like the class_exists check for StatuspageController is no longer sufficient to prevent it from running when it shouldn't. Adding && \Drupal::hasContainer() seems to fix it. I have no idea if that's the best solution.

Remaining tasks

Unknown

User interface changes

None

API changes

None

Data model changes

None

๐Ÿ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡ชIreland John Morahan

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

Comments & Activities

Production build 0.71.5 2024