merged branch drak/eventsubscribersnotice (PR #3902)

Commits
-------

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

Discussion
----------

[EventDispatcher] Fixed edge case not covered by tests.

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

Fixes case not covered by tests.
This commit is contained in:
Fabien Potencier 2012-04-12 13:47:50 +02:00
commit b2af6b4f24
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'),
);
}