[Security] Do not use First Class Callable Syntax for listeners#46260
Closed
javer wants to merge 1 commit intosymfony:6.1from
Closed
[Security] Do not use First Class Callable Syntax for listeners#46260javer wants to merge 1 commit intosymfony:6.1from
javer wants to merge 1 commit intosymfony:6.1from
Conversation
|
It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you. Cheers! Carsonbot |
Contributor
Author
|
Also it seems that CI is broken: and so on. |
stof
approved these changes
May 5, 2022
Member
|
See #46262 |
Member
|
Closing in favor of #46262 which reuses the test cases you contributed. Thank you. |
nicolas-grekas
added a commit
that referenced
this pull request
May 5, 2022
…class callable syntax (javer) This PR was merged into the 4.4 branch. Discussion ---------- [EventDispatcher] Fix removing listeners when using first-class callable syntax | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #46260 | License | MIT | Doc PR | - Closures should be compared using non-strict comparison to account for the first-class callable syntax. See https://github.com/php/php-src/blob/9a90bd705483004c2ef408ee9e9bb0902beade3f/Zend/zend_closures.c#L387-L423 Commits ------- df4c003 [EventDispatcher] Fix removing listeners when using first-class callable syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes usage of First Class Callable Syntax for registering listeners which are intended to be unregistered later.
I'm targeting 6.1 branch because the issue was introduced only in this branch via b0217c6
The reason of this change is clear from the following example:
In other words, it's not safe to use First Class Callable Syntax in the cases when we need to refer to the same function to remove it from somewhere, because each
method(...)returns a new function.