Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
dawehnerThat's just a duplicate of #1953800: Make the database connection serializable