Skip to content

[EventDispatcher] LegacyEventDispatcherProxy incompatible with WrappedListener #31457

@keulinho

Description

@keulinho

Symfony version(s) affected: 4.3.0

Description
The \Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy implements the EventDispatcherInterface from the Contracts Bundle, but the \Symfony\Component\EventDispatcher\Debug\WrappedListener expects the EventDispatcherInterface from the EventDispatcher Bundle in its __invoke() method.

This leads to the error below.

How to reporduce*
Dispatch an Event with the deprecated dispatch(Event $event) signature, when your are in a dev env.

Possible Solution
The \Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy should probably implement the EventDispatcherInterface from the EventDispatcher Bundle as it already implements all additional functions described by the EventDispatcherInterface from the EventDispatcher Bundle compared to the interface from the Contracts Bundle.

Additional context

PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Argument 3 passed to Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke() must implement interface Symfony\Component\EventDispatcher\EventDispatcherInterface, instance of Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy given, called in /app/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php on line 78 in /app/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:113
        Stack trace:
        #0 /app/vendor/symfony/event-dispatcher/LegacyEventDispatcherProxy.php(78): Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(Object(Symfony\Component\Console\Event\ConsoleErrorEvent), 'console.error', Object(Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy))
        #1 /app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php(168): Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy->dispatch(Object(Symfony\Component\Console\Event\ConsoleErrorEvent), 'console.error')
        #2 /app/vendor/sym in /app/vendor/symfony/event-dispatcher/Debug/WrappedListener.php on line 113

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy