Exceptions caused by middleware service using the entity_type.manager

Created on 27 November 2024, 22 days ago

There is a Drupal Core issue 🐛 ModuleHandler skips all hook implementations when invoked before the module files have been loaded Needs review that impacts this module.

I have been experiencing random errors on my test site since enabling the IP Login module.

A more concrete example is a middleware service using the entity_type.manager. Most of the times the entity type information is retrieved from cache (stored in the discovery cache bin). When this cache however is missing, hooks like hook_entity_type_build() and hook_entity_type_alter() need to be invoked at this early stage. The modules files however haven't been loaded yet, making ModuleHanlder::verifyImplementations() skip all the hook implementations (silently!). The entity definition cache is then incomplete resulting in various hard to debug (next to impossible) exceptions

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇦🇺Australia akoepke

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

Comments & Activities

Production build 0.71.5 2024