Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32f6534

Browse filesBrowse files
committed
bug #23024 [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null) (nicolas-grekas)
This PR was merged into the 2.7 branch. Discussion ---------- [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null) | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- e7c4149 [EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null)
2 parents 78c4a5f + e7c4149 commit 32f6534
Copy full SHA for 32f6534

File tree

2 files changed

+2
-1
lines changed
Filter options

2 files changed

+2
-1
lines changed

‎src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function removeListener($eventName, $listener)
105105
public function hasListeners($eventName = null)
106106
{
107107
if (null === $eventName) {
108-
return (bool) count($this->listenerIds) || (bool) count($this->listeners);
108+
return $this->listenerIds || $this->listeners || parent::hasListeners();
109109
}
110110

111111
if (isset($this->listenerIds[$eventName])) {

‎src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function testAddListener()
5656
{
5757
$this->dispatcher->addListener('pre.foo', array($this->listener, 'preFoo'));
5858
$this->dispatcher->addListener('post.foo', array($this->listener, 'postFoo'));
59+
$this->assertTrue($this->dispatcher->hasListeners());
5960
$this->assertTrue($this->dispatcher->hasListeners(self::preFoo));
6061
$this->assertTrue($this->dispatcher->hasListeners(self::postFoo));
6162
$this->assertCount(1, $this->dispatcher->getListeners(self::preFoo));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.