Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[EventDispatcher] Try first if the event is Stopped#18426
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
unkind commentedApr 3, 2016
Does it make sense to dispatch stopped event? Raising exception here seems more appropriate. |
lyrixx commentedApr 4, 2016
I don't think so, because it will make userland code harder to write. |
stof commentedApr 4, 2016
@lyrixx I think such case should add a log message in the traceable event dispatcher, as it could also be a mistake in the userland code (people not knowing that stopping the the propagation of the first event will impact the next event because they reused the same event object) |
lyrixx commentedApr 4, 2016
@stof Good idea. I added it. |
nicolas-grekas commentedApr 4, 2016
👍 |
unkind commentedApr 4, 2016
How does error reporting make harder to write? |
javiereguiluz commentedApr 4, 2016
👍 |
lyrixx commentedApr 4, 2016
there is not error IMHO. see this for instance:https://github.com/symfony/symfony/pull/11882/files#diff-6d1e8dc0d2c0e7c4ab206d0efbb71516R161 |
nicolas-grekas commentedApr 4, 2016
Thank you@lyrixx. |
This PR was merged into the 2.3 branch.Discussion----------[EventDispatcher] Try first if the event is Stopped| Q | A| ------------- | ---| Branch? | 2.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets | -| License | MIT| Doc PR | -If you trigger 2 events with the same instance of Event and if a listener in the first dispatch stop the propagation, then the very first listener of the second dispatch is called. It should not IMHO.Commits-------a30e166 [EventDispatcher] Try first if the event is Stopped
If you trigger 2 events with the same instance of Event and if a listener in the first dispatch stop the propagation, then the very first listener of the second dispatch is called. It should not IMHO.