Skip to content
GitLab
  • Explore
  • Sign in
  • DevelopmentDevelopment
  • CiviCRM CoreCiviCRM Core
  • Issues
  • #3802

Symfony 6 can't find the EventDispatcher when adding hooks that are defined in getSubscribedEvents

They did this, and also a little higher up you can see they removed the constructor: https://github.com/symfony/event-dispatcher/commit/0bc2e0d8ba8a6eb353a42d19890f57a3dee410a5#diff-f3f413e17bbd20e345b3721f9c4556ed5e319d133c32bf7492dffd55a024d0efR57

So what happens is this https://github.com/civicrm/civicrm-core/blob/da21dc84950b013a03d3fe5e72e12e7d652cce7f/Civi/Core/Container.php#L93 is expecting it to be called dispatcher, but this https://github.com/symfony/event-dispatcher/commit/0bc2e0d8ba8a6eb353a42d19890f57a3dee410a5#diff-f3f413e17bbd20e345b3721f9c4556ed5e319d133c32bf7492dffd55a024d0efR57 is expecting it to be called event_dispatcher, so that returns early and never calls $container->findTaggedServiceIds('kernel.event_listener', so doesn't pick up any of the getSubscribedEvents hooks, e.g. civi.token.eval and others.

The naive fix of calling $container->setAlias('event_dispatcher', 'dispatcher') doesn't seem to be enough and causes a crash later which I haven't tracked down yet.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking