Skip to content

EventListener Broken with 5.0.x #35259

@hjanuschka

Description

@hjanuschka

Symfony version(s) affected: 5.0.x

Description

we are in the process of migrating from 4.4 to 5.0
however some of the registered event listeners, don't return a priorty - aka null

this happens around here:

https://sourcegraph.com/github.com/symfony/symfony@20bf17f6ad38011f90cfe9b2dc7c30c8901163e5/-/blob/src/Symfony/Component/EventDispatcher/EventDispatcher.php#L117

as the $this->listeners[$eventName] is nested one more times.

it results in a final exception:
Bildschirmfoto 2020-01-08 um 13 28 26

due to https://sourcegraph.com/github.com/symfony/symfony@20bf17f6ad38011f90cfe9b2dc7c30c8901163e5/-/blob/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php#L55 - beeing type hinted with int

introduced with: 2bc9472

my event definition:

services:
    krn.demo:
        class: App\EventSubscriber\Demo
        public: false
        shared: false
        tags:
          - { name: kernel.event_listener, event: krn.demo, method: onEvent }

How to reproduce

clone: https://github.com/hjanuschka/demo

composer install
 bin/console debug:event-dispatcher krn.demo

Bildschirmfoto 2020-01-08 um 13 33 02

where it should show 0

Possible Solution

return 0; instead of return null in getListenerPriority

PR: #35260

any help?

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