Avoid leaving the event stack in a dirty state if an event listener throws, fixes #9846
parent
a844fce23e
commit
37f4f531d0
|
@ -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…
Reference in New Issue