merged branch drak/eventsubscriber_notice (PR #3900)

Commits
-------

57dd914 [EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber with mixed priorities

Discussion
----------

[EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -
Todo: -

This fixes a case that was not covered by the existing tests.
This commit is contained in:
Fabien Potencier 2012-04-12 12:25:57 +02:00
commit 3bd2e01ea7
2 changed files with 5 additions and 2 deletions

View File

@ -117,7 +117,7 @@ class EventDispatcher implements EventDispatcherInterface
if (is_string($params)) { if (is_string($params)) {
$this->addListener($eventName, array($subscriber, $params)); $this->addListener($eventName, array($subscriber, $params));
} else { } else {
$this->addListener($eventName, array($subscriber, $params[0]), $params[1]); $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
} }
} }
} }

View File

@ -241,6 +241,9 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
{ {
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array('pre.foo' => array('preFoo', 10)); return array(
'pre.foo' => array('preFoo', 10),
'post.foo' => array('postFoo'),
);
} }
} }