Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

EventListener Broken with 5.0.x #35259

Copy link
Copy link
Closed
Closed
Copy link
@hjanuschka

Description

@hjanuschka
Issue body actions

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.