Skip to content
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

Fixed setting of sorted array of listeners in EventManager to empty a… #81

Closed
wants to merge 1 commit into from

Conversation

kytart
Copy link
Contributor

@kytart kytart commented Sep 30, 2015

Kdyby\Events\EventManager::sorted[$eventName] is set to an empty array even when there are more subscribers for the same event. It's enough to remove one and it effectively removes all of them, because when the event is dispatched, the EventManager looks at this array and doesn't find any listeners, even tough there are still some in Kdyby\Events\EventManager::listeners.

This pull request should fix this issue. Now, the array is only set to an empty array after explicit check, that listeners[$eventName] array is also empty.

The addressed issue is described more in depth here.

@fprochazka
Copy link
Member

Great catch! Do you think you can provide a test case, so we won't reintroduce the bug?

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

Successfully merging this pull request may close these issues.

2 participants