Active
Project:
Shield
Version:
8.x-1.8
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Jan 2025 at 19:36 UTC
Updated:
25 Jun 2025 at 15:00 UTC
Jump to comment: Most recent
On initial site URL view and even after credentials submission and validation the following error is logged three times.
Drupal: 11.1
Shield:
TypeError: Drupal\Core\Entity\EntityTypeManager::Drupal\Core\Entity\{closure}(): Argument #1 ($hook) must be of type callable, string given, called in /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php on line 307 in Drupal\Core\Entity\EntityTypeManager->Drupal\Core\Entity\{closure}() (line 117 of /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php)
#0 /var/www/html/docroot/core/lib/Drupal/Core/Extension/ModuleHandler.php(307): Drupal\Core\Entity\EntityTypeManager->Drupal\Core\Entity\{closure}()
#1 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(117): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#2 /var/www/html/docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(213): Drupal\Core\Entity\EntityTypeManager->findDefinitions()
#3 /var/www/html/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(22): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
#4 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(132): Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
#5 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(257): Drupal\Core\Entity\EntityTypeManager->getDefinition()
#6 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php(192): Drupal\Core\Entity\EntityTypeManager->getHandler()
#7 /var/www/html/docroot/core/modules/user/src/UserAuthentication.php(64): Drupal\Core\Entity\EntityTypeManager->getStorage()
#8 /var/www/html/docroot/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php(99): Drupal\user\UserAuthentication->lookupAccount()
#9 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(336): Drupal\basic_auth\Authentication\Provider\BasicAuth->authenticate()
#10 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(256): Drupal\shield\ShieldMiddleware->basicAuthRequestAuthenticate()
#11 /var/www/html/docroot/modules/contrib/shield/src/ShieldMiddleware.php(219): Drupal\shield\ShieldMiddleware->bypass()
#12 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\shield\ShieldMiddleware->handle()
#13 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#14 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#15 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#16 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(709): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#17 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle()
#18 {main}
While the module features do function, errors are still logged. But only on the first request to the domain where the login prompt is enabled.
Comments
Comment #2
emptyvoid commentedComment #3
emptyvoid commentedWhen this scenario occurs (which is now verfied 100% by 10 different users) the system corrupts the Drupal registry and no site visitor can view the site.
The only solution requires manually logging into the target HTTP server and issuing a drush cr to rebuilt the cache and Drupal registry.
Every new user which authenticates to view the site, immediately corrupts and registry and cache for all active users.
This is a black flag bug.
Comment #4
liam morlandAre you able to add a test that demonstrates this? That would help to get it solved and prevent a regression.
Comment #5
pingwin4egI have a similar issue
but right after the cache rebuilding. And I don't use the shield module, this issue is the only similar one appearing in google results. So I think the issue can be in Drupal core actually.
Drupal 11.1.6, PHP 8.4.5.
Comment #6
pingwin4egLooks like a hook is trying to be invoked, but the module, which implements it, is not loaded.
Comment #7
nicxvan commentedDoes this help #3505049: Drupal 11.1.2 upgrade causes \Drupal::$container is not initialized yet error
Comment #8
vbouchetI suspect it is linked to https://www.drupal.org/project/shield/issues/3277210.
Comment #9
ram4nd commentedIn 11.2.x I get "white screen of death", with this error:
Comment #10
pingwin4eg@ram4nd That is a totally different error. This issue is about
($hook) must be of type callable, your error is($config_factory) must be of type Drupal\Core\Config\ConfigFactoryInterface.