Skip to content

Deprecation for event_dispatcher service is still triggered #23054

Closed
@garak

Description

@garak
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.0

As mentioned in #22223, it looks like the deprecation notice about ContainerAwareEventDispatcher is still emerging in some cases.
Step to reproduce:

  • install standard edition via create-project symfony/framework-standard-edition foo
  • enter project with cd foo
  • install bundle via composer require knplabs/knp-paginator-bundle
  • enable bundle by adding new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle() in registerBundles of AppKernel

Expected behavior: launching bin/console server:run and navigating to http://127.0.0.1:8000/, no deprecations about ContainerAwareEventDispatcher should be triggered.
Actual behavior: launching bin/console server:run and navigating to http://127.0.0.1:8000/, I see in debug toolbar "User Deprecated: The Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher class is deprecated since version 3.3 and will be removed in 4.0. Use EventDispatcher with closure-proxy injection instead."

The relevant part of source code is in var/cache/dev/appDevDebugProjectContainer.php and it's following

protected function getDebug_EventDispatcherService()
{    
    $this->services['debug.event_dispatcher'] = $instance = new \Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher(new \Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher($this), ${($_ = isset($this->services['debug.stopwatch']) ? $this->services['debug.stopwatch'] : $this->get('debug.stopwatch')) && false ?: '_'}, ${($_ = isset($this->services['monolog.logger.event']) ? $this->services['monolog.logger.event'] : $this->get('monolog.logger.event', ContainerInterface::NULL_ON_INVALID_REFERENCE)) && false ?: '_'});
   // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions