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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

René-Marc Simard created an issue. See original summary.

René-Marc Simard’s picture

Title: Compatibility issue with Webprofiler » Compatibility issue with Web Profiler
Assigned: René-Marc Simard » Unassigned
Status: Active » Needs review
FileSize
1.42 KB

This 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.

lussoluca’s picture

Status: Needs review » Reviewed & tested by the community

Yes we must use the interface of a service in dependency injection, always!
Thanks for you patch

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs work

I'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.

nickvanboven’s picture

Thanks for you patch

DamienMcKenna’s picture

Status: Needs work » Closed (duplicate)

This got handled in a separate issue, sorry: #2882954: Error when updating to 8.x-1.1

DamienMcKenna’s picture

PS I updated the CHANGELOG.txt to mention this issue too, so René-Marc Simard will get some recognition for the patch.

DamienMcKenna’s picture