-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Bug in autowiring collisions detection #21658
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
Closed
Conversation
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
317b677
to
6f578ee
Compare
Maybe we could split the AutowirePass in two parts: first, we would register all the missing services; in a second time, we would do the real autowiring. That would fix this issue but probably other edge cases would still be there. Sounds like a complicated issue. Another idea: store the types used previously and check that new services registered don't implement them. |
Closed in favor of #21665 |
fabpot
added a commit
that referenced
this pull request
Feb 19, 2017
…(nicolas-grekas, GuilhemN) This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Fix autowiring collisions detection | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | Fixes #21658 by implementing the second proposal of #21658 (comment): > Another idea: store the types used previously and check that new services registered don't implement them. Commits ------- bb70472 [DependencyInjection] Fix autowiring collisions detection 6f578ee [DI] Bug in autowiring collisions detection
symfony-splitter
pushed a commit
to symfony/dependency-injection
that referenced
this pull request
Feb 19, 2017
…(nicolas-grekas, GuilhemN) This PR was merged into the 2.8 branch. Discussion ---------- [DependencyInjection] Fix autowiring collisions detection | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | Fixes symfony/symfony#21658 by implementing the second proposal of symfony/symfony#21658 (comment): > Another idea: store the types used previously and check that new services registered don't implement them. Commits ------- bb70472dce [DependencyInjection] Fix autowiring collisions detection 6f578ee514 [DI] Bug in autowiring collisions detection
fabpot
added a commit
that referenced
this pull request
Apr 3, 2017
…andidates (nicolas-grekas) This PR was merged into the 2.8 branch. Discussion ---------- [DI] Don't use auto-registered services to populate type-candidates | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no (every bug fix is a bc break, isn't it?) | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22162, ~~#21658~~ | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> Alternative to #22170 and ~~#21665~~. The core issue fixed here is that auto-registered services should *not* be used as type-candidates. The culprit is this line: `$this->populateAvailableType($argumentId, $argumentDefinition);` Doing so creates a series of wtf-issues (the linked ones), with no simple fixes (the linked PRs are just dealing with the simplest cases, but the real fix would require a reboot of autowiring for every newly discovered types.) The other changes accommodate for the removal of the population of the `types` property, and fix a few other issues found along the way: - variadic constructors - empty strings injection - tail args removal when they match the existing defaults Commits ------- 992c677 [DI] Don't use auto-registered services to populate type-candidates
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.
That's a failing test case, showing that autowiring collisions detection sometimes relies on ordering, which should not be the case.