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 e7c4149

Browse filesBrowse files
[EventDispatcher] Fix ContainerAwareEventDispatcher::hasListeners(null)
1 parent 78c4a5f commit e7c4149
Copy full SHA for e7c4149

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.