[EventDispatcher] Fixed edge case not covered by tests that generated E_NOTICES

This commit is contained in:
Drak 2012-04-12 16:21:33 +05:45
parent 5a320ca7bd
commit e199049581
2 changed files with 3 additions and 1 deletions

View File

@ -141,7 +141,7 @@ class ContainerAwareEventDispatcher extends EventDispatcher
if (is_string($params)) {
$this->listenerIds[$eventName][] = array($serviceId, $params, 0);
} elseif (is_string($params[0])) {
$this->listenerIds[$eventName][] = array($serviceId, $params[0], $params[1]);
$this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0);
} else {
foreach ($params as $listener) {
$this->listenerIds[$eventName][] = array($serviceId, $listener[0], isset($listener[1]) ? $listener[1] : 0);

View File

@ -245,6 +245,8 @@ class SubscriberService implements EventSubscriberInterface
static function getSubscribedEvents() {
return array(
'onEvent' => 'onEvent',
'onEvent' => array('onEvent', 10),
'onEvent' => array('onEvent'),
);
}