Closed
Description
Symfony version(s) affected: 5.3.7
Description
I was using in the past the general TraceableEventDispatcher in debug mode to track my user actions during dev.
It is not fully possible anymore since version 5.3.7.
The security dispatcher is only a EventDispatcher class.
NB: Therefore, the profiler is pretending security events are not triggered
How to reproduce
<?php
// SecuritySubscriber.php
namespace xKzl\MyBundle\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\DependencyInjection\Argument\ServiceLocator;
use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher;
class SecuritySubscriber implements EventSubscriberInterface
{
/**
* @var array[TraceableEventDispatcher]
*/
private $dispatchers = [];
public function __construct(
ServiceLocator $dispatcherLocator) {
$this->dispatcherLocator = $dispatcherLocator;
foreach($this->dispatcherLocator->getProvidedServices() as $dispatcherId => $_) {
$dispatcher = $this->dispatcherLocator->get($dispatcherId);
if (!$dispatcher instanceof TraceableEventDispatcher) continue;
$dispatchers[] = $this->dispatcherLocator->get($dispatcherId);
}
dump($dispatchers);
}
public static function getSubscribedEvents()
{
return [];
}
}
I declared my subscriber as following:
<service id="xKzl\MyBundle\Subscriber\SecuritySubscriber">
<tag name="kernel.event_subscriber" />
<argument type="tagged_locator" tag="event_dispatcher.dispatcher" index-by="name"/>
</service>