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.
This commit is contained in:
commit
7966d8f831
@ -132,6 +132,10 @@ class TraceableEventDispatcher implements EventDispatcherInterface, TraceableEve
|
||||
|
||||
$this->firstCalledEvent[$eventName] = $this->stopwatch->start($eventName.'.loading', 'event_listener_loading');
|
||||
|
||||
if (!$this->dispatcher->hasListeners($eventName)) {
|
||||
$this->firstCalledEvent[$eventName]->stop();
|
||||
}
|
||||
|
||||
$this->dispatcher->dispatch($eventName, $event);
|
||||
|
||||
// reset the id as another event might have been dispatched during the dispatching of this event
|
||||
|
Reference in New Issue
Block a user