-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[EventDispathcer] Fix removeListener #7023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Probably related to https://bugs.php.net/bug.php?id=62976, I need to do some more investigation - I use 546. anyway the fix is valid for whatever php version. |
This is related to the PHP bug mentioned above, see http://3v4l.org/Q6WKj:
@fabpot anything more needed to merge this ? |
Is it possible to add a test? |
It is, for php versions < fixed version, I'll do that |
@fabpot ready Sir ! |
well I can probably add an assert, please wait ! |
This PR was squashed before being merged into the 2.0 branch (closes #7023). Commits ------- 87f3db7 [EventDispathcer] Fix removeListener Discussion ---------- [EventDispathcer] Fix removeListener | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Todo - [x] Add a UT I won't have time to add a test before next Friday but this PR could save some debugging (especially with Silex & Closures) --------------------------------------------------------------------------- by vicb at 2013-02-09T23:32:51Z Probably related to https://bugs.php.net/bug.php?id=62976, I need to do some more investigation - I use 546. anyway the fix is valid for whatever php version. --------------------------------------------------------------------------- by vicb at 2013-02-10T10:24:46Z This **is** related to the PHP bug mentioned above, see http://3v4l.org/Q6WKj: ``` Output for 5.3.18 - 5.3.21, 5.4.8 - 5.5.0alpha4 bool(false) Output for 5.3.0 - 5.3.17, 5.4.0 - 5.4.7 Notice: Object of class Klass could not be converted to int in /in/Q6WKj on line 9 Notice: Object of class Closure could not be converted to int in /in/Q6WKj on line 9 int(0) ``` @fabpot anything more needed to merge this ? --------------------------------------------------------------------------- by fabpot at 2013-02-10T10:26:52Z Is it possible to add a test? --------------------------------------------------------------------------- by vicb at 2013-02-10T10:29:34Z It is, for php versions < fixed version, I'll do that --------------------------------------------------------------------------- by vicb at 2013-02-10T10:42:01Z @fabpot ready Sir ! --------------------------------------------------------------------------- by vicb at 2013-02-10T10:44:35Z well I can probably add an assert, please wait !
yep nothing really to assert anyway, np. |
@fabpot seems like you script isn't closing PR any more ? |
@vicb I think it actually makes sense to add an assertion here to show an intent of the test. |
@jakzal what would you assert ? |
I'd assert that listener is not removed: #7038 |
@vicb: my script never closes tickets, Github does. But, recently, Github changes the way it closes PRs. |
Ah right, seen this on their blog. Fabien Potencier [email protected] wrote:
|
This PR was merged into the 2.0 branch. Commits ------- 4ce9ac3 [EventDispatcher] Added assertion. Discussion ---------- [EventDispatcher] Added assertion re #7023, I think it actually makes sense to add an assertion here. It reveals the intent of the test (listener is not removed). --------------------------------------------------------------------------- by vicb at 2013-02-10T11:32:06Z I don't think the assertion would fail with the former code, would it ? --------------------------------------------------------------------------- by vicb at 2013-02-10T11:34:30Z I mean an error would be generated even before the assertion. --------------------------------------------------------------------------- by jakzal at 2013-02-10T11:37:05Z Yes, it would fail before getting to the assertion with: *Object of class Closure could not be converted to int*. However, this is something good to test for (and document - test is a documentation). We're not checking if type is taken into account in other tests. This test might still fail if code inside removeListener() changed. --------------------------------------------------------------------------- by vicb at 2013-02-10T11:42:29Z I don't really understand your point and think it is a bit useless here but I am not against your change - I don't argue that test is doc though. --------------------------------------------------------------------------- by jakzal at 2013-02-10T15:38:09Z Assertion is indeed useless for the bug you discovered and fixed. I think it's still worth to have it there for other reason: * test readability and completeness - with an assertion it's more clear that we don't expect the listener to be removed with the `removeListener()` call if passed argument doesn't match the one added before If you still don't see my point just close this PR :) --------------------------------------------------------------------------- by vicb at 2013-02-10T17:34:35Z What I mean is that you are unit testing php and it is not a job for sf. So it is not strictly required but as it doesn't hurt, let's merge your change. Jakub Zalas <[email protected]> wrote: >Assertion is indeed useless for the bug you discovered and fixed. I >think it's still worth to have it there for other reason: >* test readability and completeness - with an assertion it's more clear >that we don't expect the listener to be removed with the >`removeListener()` call if passed argument doesn't match the one added >before > >If you still don't see my point just close this PR :) > > >--- >Reply to this email directly or view it on GitHub: >#7038 (comment)
Todo
I won't have time to add a test before next Friday but this PR could save some debugging (especially with Silex & Closures)