10000 [EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscr… · symfony/symfony@57dd914 · GitHub
[go: up one dir, main page]

Skip to content

Commit 57dd914

Browse files
author
Drak
committed
[EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber with mixed priorities
1 parent 8835357 commit 57dd914

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Symfony/Component/EventDispatcher/EventDispatcher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
117117
if (is_string($params)) {
118118
$this->addListener($eventName, array($subscriber, $params));
119119
} else {
120-
$this->addListener($eventName, array($subscriber, $params[0]), $params[1]);
120+
$this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
121121
}
122122
}
123123
}

tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
241241
{
242242
public static function getSubscribedEvents()
243243
{
244-
return array('pre.foo' => array('preFoo', 10));
244+
return array(
245+
'pre.foo' => array('preFoo', 10),
246+
'post.foo' => array('postFoo'),
247+
);
245248
}
246249
}

0 commit comments

Comments
 (0)
0