Avoid leaving the event stack in a dirty state if an event listener throws, fixes #9846

main
Jordi Boggiano 3 years ago
parent a844fce23e
commit 37f4f531d0
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -157,6 +157,7 @@ class EventDispatcher
$this->pushEvent($event);
try {
$returnMax = 0;
foreach ($listeners as $callable) {
$return = 0;
@ -294,6 +295,11 @@ class EventDispatcher
break;
}
}
} catch (\Exception $e) {
$this->popEvent();
throw $e;
}
$this->popEvent();

Loading…
Cancel
Save