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

This commit is contained in:
Drak 2012-04-12 15:48:16 +05:45
parent 88353575e4
commit 57dd9147d9
2 changed files with 5 additions and 2 deletions

View File

@ -117,7 +117,7 @@ class EventDispatcher implements EventDispatcherInterface
if (is_string($params)) {
$this->addListener($eventName, array($subscriber, $params));
} 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()
{
return array('pre.foo' => array('preFoo', 10));
return array(
'pre.foo' => array('preFoo', 10),
'post.foo' => array('postFoo'),
);
}
}