8000 Fix wrapped loop of event listener · symfony/symfony@a137088 · GitHub
[go: up one dir, main page]

Skip to content

Commit a137088

Browse files
committed
Fix wrapped loop of event listener
1 parent 6c3c47e commit a137088

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,18 +132,24 @@ public function dispatch($eventName, Event $event = null)
132132
}
133133

134134
$this->preProcess($eventName);
135-
$this->preDispatch($eventName, $event);
135+
try {
136+
$this->preDispatch($eventName, $event);
136137

137-
$e = $this->stopwatch->start($eventName, 'section');
138+
$e = $this->stopwatch->start($eventName, 'section');
138139

139-
$this->dispatcher->dispatch($eventName, $event);
140+
$this->dispatcher->dispatch($eventName, $event);
140141

141-
if ($e->isStarted()) {
142-
$e->stop();
143-
}
142+
if ($e->isStarted()) {
143+
$e->stop();
144+
}
144145

145-
$this->postDispatch($eventName, $event);
146-
$this->postProcess($eventName);
146+
$this->postDispatch($eventName, $event);
147+
} finally {
148+
if ($e && $e->isStarted()) {
149+
$e->stop();
150+
}
151+
$this->postProcess($eventName);
152+
}
147153

148154
return $event;
149155
}

0 commit comments

Comments
 (0)
0