Skip to content
This repository

[EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscriber #3900

Merged
merged 1 commit into from about 2 years ago

3 participants

Drak Igor Wiedler Fabien Potencier
Drak
Collaborator
drak commented April 12, 2012

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.

Fabien Potencier fabpot referenced this pull request from a commit April 12, 2012
Fabien Potencier 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.
3bd2e01
Fabien Potencier fabpot merged commit 57dd914 into from April 12, 2012
Fabien Potencier fabpot closed this April 12, 2012
Igor Wiedler igorw commented on the diff April 12, 2012
tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php
@@ -241,6 +241,9 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
241 241
 {
242 242
     public static function getSubscribedEvents()
243 243
     {
244  
-        return array('pre.foo' => array('preFoo', 10));
  244
+        return array(
  245
+            'pre.foo' => array('preFoo', 10),
  246
+            'post.foo' => array('postFoo'),
  247
+            );
4
Igor Wiedler
igorw added a note April 12, 2012

CS: this should probably be unindented.

Drak Collaborator
drak added a note April 12, 2012

Done for readability.

Igor Wiedler
igorw added a note April 12, 2012

Sorry, I meant:

return array(
    'pre.foo' => array('preFoo', 10),
    'post.foo' => array('postFoo'),
);
Drak Collaborator
drak added a note April 12, 2012

Yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
mmucklo mmucklo referenced this pull request from a commit April 12, 2012
Fabien Potencier 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.
3e410b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 12, 2012
Drak [EventDispatcher] Fixed E_NOTICES with multiple eventnames per subscr…
…iber with mixed priorities
57dd914
This page is out of date. Refresh to see the latest.
2  src/Symfony/Component/EventDispatcher/EventDispatcher.php
@@ -117,7 +117,7 @@ public function addSubscriber(EventSubscriberInterface $subscriber)
117 117
             if (is_string($params)) {
118 118
                 $this->addListener($eventName, array($subscriber, $params));
119 119
             } 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);
121 121
             }
122 122
         }
123 123
     }
5  tests/Symfony/Tests/Component/EventDispatcher/EventDispatcherTest.php
@@ -241,6 +241,9 @@ class TestEventSubscriberWithPriorities implements EventSubscriberInterface
241 241
 {
242 242
     public static function getSubscribedEvents()
243 243
     {
244  
-        return array('pre.foo' => array('preFoo', 10));
  244
+        return array(
  245
+            'pre.foo' => array('preFoo', 10),
  246
+            'post.foo' => array('postFoo'),
  247
+            );
245 248
     }
246 249
 }
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.