Problem/Motivation
When running Drush 13.3.3.0 on D11 the following error message
docker@cli:/var/www$ drush -vvv updb
[preflight] Config paths: /var/www/vendor/drush/drush/drush.yml
[preflight] Alias paths: /var/www/web/drush/sites,/var/www/drush/sites
[preflight] Commandfile search paths: /var/www/vendor/drush/drush/src,/var/www/drush
[info] Starting bootstrap to full [0.24 sec, 11.25 MB]
[info] Drush bootstrap phase 5 [0.24 sec, 11.25 MB]
[info] Try to validate bootstrap phase 5 [0.24 sec, 11.25 MB]
[info] Try to validate bootstrap phase 5 [0.24 sec, 11.25 MB]
[info] Try to bootstrap at phase 5 [0.24 sec, 11.25 MB]
[info] Drush bootstrap phase: bootstrapDrupalRoot() [0.24 sec, 11.25 MB]
[info] Change working directory to /var/www/web [0.24 sec, 11.25 MB]
[info] Initialized Drupal 11.1.0 root directory at /var/www/web [0.24 sec, 11.3 MB]
[info] Try to validate bootstrap phase 5 [0.24 sec, 11.3 MB]
[info] Try to bootstrap at phase 5 [0.24 sec, 11.75 MB]
[info] Drush bootstrap phase: bootstrapDrupalSite() [0.24 sec, 11.75 MB]
[debug] Could not find a Drush config file at sites/default/drush.yml. [0.24 sec, 12.54 MB]
[info] Initialized Drupal site rbht-d11.docksal.site at sites/default [0.24 sec, 12.54 MB]
[info] Try to validate bootstrap phase 5 [0.24 sec, 12.54 MB]
[info] Try to bootstrap at phase 5 [0.24 sec, 12.54 MB]
[info] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.24 sec, 12.54 MB]
[info] Try to validate bootstrap phase 5 [0.25 sec, 12.82 MB]
[info] Try to bootstrap at phase 5 [0.27 sec, 13.35 MB]
[info] Drush bootstrap phase: bootstrapDrupalDatabase() [0.27 sec, 13.35 MB]
[info] Successfully connected to the Drupal database. [0.27 sec, 13.35 MB]
[info] Try to validate bootstrap phase 5 [0.27 sec, 13.35 MB]
[info] Try to bootstrap at phase 5 [0.27 sec, 13.35 MB]
[info] Drush bootstrap phase: bootstrapDrupalFull() [0.27 sec, 13.35 MB]
[debug] Start bootstrap of the Drupal Kernel. [0.27 sec, 13.35 MB]
In Drupal.php line 169:
[Drupal\Core\DependencyInjection\ContainerNotInitializedException]
\Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container.
Exception trace:
at /var/www/web/core/lib/Drupal.php:169
Drupal::getContainer() at /var/www/web/core/lib/Drupal.php:543
Drupal::moduleHandler() at /var/www/web/modules/contrib/workflow/workflow.module:38
include_once() at /var/www/web/core/lib/Drupal/Core/Hook/HookCollectorPass.php:184
Drupal\Core\Hook\HookCollectorPass->collectModuleHookImplementations() at /var/www/web/core/lib/Drupal/Core/Hook/HookCollectorPass.php:147
Drupal\Core\Hook\HookCollectorPass::collectAllHookImplementations() at /var/www/web/core/lib/Drupal/Core/Hook/HookCollectorPass.php:78
Drupal\Core\Hook\HookCollectorPass->process() at /var/www/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /var/www/vendor/symfony/dependency-injection/ContainerBuilder.php:814
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /var/www/web/core/lib/Drupal/Core/DrupalKernel.php:1380
Drupal\Core\DrupalKernel->compileContainer() at /var/www/web/core/lib/Drupal/Core/DrupalKernel.php:899
Drupal\Core\DrupalKernel->initializeContainer() at /var/www/web/core/lib/Drupal/Core/Update/UpdateKernel.php:42
Drupal\Core\Update\UpdateKernel->initializeContainer() at /var/www/web/core/lib/Drupal/Core/DrupalKernel.php:505
Drupal\Core\DrupalKernel->boot() at /var/www/vendor/drush/drush/src/Boot/DrupalBoot8.php:209
Drush\Boot\DrupalBoot8->bootstrapDrupalFull() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:211
Drush\Boot\BootstrapManager->doBootstrap() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:352
Drush\Boot\BootstrapManager->bootstrapToPhaseIndex() at /var/www/vendor/drush/drush/src/Boot/BootstrapManager.php:304
Drush\Boot\BootstrapManager->bootstrapToPhase() at /var/www/vendor/drush/drush/src/Boot/BootstrapHook.php:36
Drush\Boot\BootstrapHook->initialize() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/www/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:376
Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/www/vendor/symfony/console/Command/Command.php:245
Symfony\Component\Console\Command\Command->run() at /var/www/vendor/symfony/console/Application.php:1094
Symfony\Component\Console\Application->doRunCommand() at /var/www/vendor/symfony/console/Application.php:342
Symfony\Component\Console\Application->doRun() at /var/www/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->run() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:110
Drush\Runtime\Runtime->doRun() at /var/www/vendor/drush/drush/src/Runtime/Runtime.php:40
Drush\Runtime\Runtime->run() at /var/www/vendor/drush/drush/drush.php:140
include() at /var/www/vendor/bin/drush.php:119
Steps to reproduce
Build a Drupal D11.1.0 and Drush 13.3.3.0 and run the drush updb command.
Proposed resolution
Using the pattern used by webform to include files replace
\Drupal::moduleHandler()->loadInclude('workflow', 'inc', 'workflow.devel');
\Drupal::moduleHandler()->loadInclude('workflow', 'inc', 'workflow.entity');
\Drupal::moduleHandler()->loadInclude('workflow', 'inc', 'workflow.field');
\Drupal::moduleHandler()->loadInclude('workflow', 'inc', 'workflow.form');
\Drupal::moduleHandler()->loadInclude('workflow', 'inc', 'workflow.migrate');
with
require_once __DIR__ . '/workflow.devel.inc';
require_once __DIR__ . '/workflow.entity.inc';
require_once __DIR__ . '/workflow.field.inc';
require_once __DIR__ . '/workflow.form.inc';
require_once __DIR__ . '/workflow.migrate.inc';
in workflow.module
Remaining tasks
None
User interface changes
None
API changes
None
Data model changes
None