Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 2 commits into from
Closed

[EventDispathcer] Fix removeListener #7023

wants to merge 2 commits into from

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Feb 8, 2013

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets ~
License MIT
Doc PR ~

Todo

  • 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)

@vicb
Copy link
Contributor Author

vicb commented Feb 9, 2013

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.

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

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 ?

@fabpot
Copy link
Member

fabpot commented Feb 10, 2013

Is it possible to add a test?

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

It is, for php versions < fixed version, I'll do that

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

@fabpot ready Sir !

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

well I can probably add an assert, please wait !

fabpot added a commit that referenced this pull request Feb 10, 2013
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 !
@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

yep nothing really to assert anyway, np.

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

@fabpot seems like you script isn't closing PR any more ?

@jakzal
Copy link
Contributor

jakzal commented Feb 10, 2013

@vicb I think it actually makes sense to add an assertion here to show an intent of the test.

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

@jakzal what would you assert ?

@jakzal
Copy link
Contributor

jakzal commented Feb 10, 2013

I'd assert that listener is not removed: #7038

@fabpot
Copy link
Member

fabpot commented Feb 10, 2013

@vicb: my script never closes tickets, Github does. But, recently, Github changes the way it closes PRs.

@vicb
Copy link
Contributor Author

vicb commented Feb 10, 2013

Ah right, seen this on their blog.

Fabien Potencier [email protected] wrote:

@vicb: my script never closes tickets, Github does. But, recently,
Github changes the way it closes PRs.


Reply to this email directly or view it on GitHub:
#7023 (comment)

fabpot added a commit that referenced this pull request Feb 11, 2013
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants