Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7966d8f

Browse files
committed
merged branch janschoenherr/patch-4 (PR #7365)
This PR was squashed before being merged into the 2.2 branch (closes #7365). Commits ------- d9ee869 [HttpKernel] Updated TraceableEventDispatcher.php Discussion ---------- [HttpKernel] Updated TraceableEventDispatcher.php | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | | License | MIT | Doc PR | Currently, if no listeners are registered for an dispatched event, the StopwatchEvent "$eventName.'.loading'" is never being stopped.
2 parents 4b9d810 + d9ee869 commit 7966d8f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public function dispatch($eventName, Event $event = null)
132132

133133
$this->firstCalledEvent[$eventName] = $this->stopwatch->start($eventName.'.loading', 'event_listener_loading');
134134

135+
if (!$this->dispatcher->hasListeners($eventName)) {
136+
$this->firstCalledEvent[$eventName]->stop();
137+
}
138+
135139
$this->dispatcher->dispatch($eventName, $event);
136140

137141
// reset the id as another event might have been dispatched during the dispatching of this event

0 commit comments

Comments
 (0)