I've had this crop up in at least 3 issues, but if you inject Drupal\Core\Extension\ModuleHandler into a form class, you get a serialize error from Drupal\Core\KeyValueStore\DatabaseStorageExpirable::setWithExpire().

This also prevents injecting any services that have ModuleHandler, like views.views_data, field.info, router.builder, or token.

We've stuck to using \Drupal::moduleHandler() in those cases for now.

Comments

dawehner’s picture

Status: Active » Closed (duplicate)