Skip to content

Commit cc35e84

Browse files
committed
Fix wrapped loop of event listener
1 parent d365fc4 commit cc35e84

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Debug/TraceableEventDispatcher.php

+16-11
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,24 @@ public function dispatch($eventName, Event $event = null)
132132
}
133133

134134
$this->preProcess($eventName);
135-
$this->preDispatch($eventName, $event);
136-
137-
$e = $this->stopwatch->start($eventName, 'section');
138-
139-
$this->dispatcher->dispatch($eventName, $event);
140-
141-
if ($e->isStarted()) {
142-
$e->stop();
135+
try {
136+
$this->preDispatch($eventName, $event);
137+
try {
138+
$e = $this->stopwatch->start($eventName, 'section');
139+
try {
140+
$this->dispatcher->dispatch($eventName, $event);
141+
} finally {
142+
if ($e->isStarted()) {
143+
$e->stop();
144+
}
145+
}
146+
} finally {
147+
$this->postDispatch($eventName, $event);
148+
}
149+
} finally {
150+
$this->postProcess($eventName);
143151
}
144152

145-
$this->postDispatch($eventName, $event);
146-
$this->postProcess($eventName);
147-
148153
return $event;
149154
}
150155

0 commit comments

Comments
 (0)