When both Metatag 8.x-1.0+21-dev and Devel's Webprofiler are enabled, the site crashes with a 500 error.
Dev recently introduced in commit d0df16e a new service dependency (@entity_type.manager), and the constructor expects to receive an EntityTypeManager accordingly.
However when the Webprofiler module is used, it defines its @webprofiler.debug.entity_type.manager service, which comes in and decorates @entity_type.manager. The end result is that Metatag's constructor no longer receives a Drupal\Core\Entity\EntityTypeManager but gets a Drupal\webprofiler\Entity\EntityManagerWrapper instead. Boom!
We should modify the constructor to receive an instance of EntityTypeManagerInterface. Things would then work as usual.
A patch to fix this will follow.
Comment | File | Size | Author |
---|---|---|---|
#2 | metatag-interface_dependency_injection-2877737-2.patch | 1.42 KB | René-Marc Simard |
Comments
Comment #2
René-Marc Simard CreditAttribution: René-Marc Simard as a volunteer commentedThis patch changes the constructor typehint for EntityTypeManager to EntityTypeManagerInterface, fixing compatibility issues whenever another module like Web Profiler comes in and decorates the EntityTypeManager service.
Comment #3
lussolucaYes we must use the interface of a service in dependency injection, always!
Thanks for you patch
Comment #4
DamienMcKennaI'd like to add a simple test file that enables Metatag and the WebProfiler and then loads a node page, just to make sure the site still works.
Comment #5
nickvanboven CreditAttribution: nickvanboven as a volunteer commentedThanks for you patch
Comment #6
DamienMcKennaThis got handled in a separate issue, sorry: #2882954: Error when updating to 8.x-1.1
Comment #7
DamienMcKennaPS I updated the CHANGELOG.txt to mention this issue too, so René-Marc Simard will get some recognition for the patch.
Comment #8
DamienMcKenna