8000 EventListener Broken with 5.0.x · Issue #35259 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

EventListener Broken with 5.0.x #35259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hjanuschka opened this issue Jan 8, 2020 · 4 comments
Closed

EventListener Broken with 5.0.x #35259

hjanuschka opened this issue Jan 8, 2020 · 4 comments

Comments

@hjanuschka
Copy link
Contributor
hjanuschka commented Jan 8, 2020

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?

@OskarStark
Copy link
Contributor

@derrabus can you please have a look here? Thanks 😊

@derrabus
Copy link
Member
derrabus commented Jan 9, 2020

@OskarStark Thanks for the ping. I'll have a look.

@xabbuh
Copy link
Member
xabbuh commented Jan 9, 2020

Can you confirm that #35278 fixes this?

@hjanuschka
Copy link
Contributor Author
hjanuschka commented Jan 9, 2020

i can confirm, #35278 correctly sets prio to 0 - in my trimmed-down-demo repo and in my main-application - many thx, i am closing my PR in favor of your's.

any eta, when this can be packed/released into 5.0.3?

many thx 🍺 🎉

nicolas-grekas added a commit that referenced this issue Jan 9, 2020
This PR was merged into the 4.3 branch.

Discussion
----------

[EventDispatcher] expand listener in place

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35259
| License       | MIT
| Doc PR        |

Commits
-------

f5d4073 expand listener in place
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
0