8000 [Firewall dispatcher] Traceable Event Dispatcher · Issue #42973 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Firewall dispatcher] Traceable Event Dispatcher  #42973
Closed
@meiyasan

Description

@meiyasan

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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0