-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DependencyInjection] Non-existent "inner" service when decorated and autowired #43272
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
Comments
Can you provide the stack trace of the exception you get ? |
Sure!
|
Do you still see the error with the latest patch release? |
Yes with version v5.3.8 @xabbuh |
Why was it closed? |
Oops sorry I read too fast as this being fixed in 5.3.8 |
Can you create a small example application that allows to reproduce your issue? |
I did a minimal snippet in the description to reproduce the issue.
|
If I may, I have the impression that all these DI issues @BafS mentioned in the OP are due to the various changes in CompilerPass ordering. If I sum up:
We end up in a cyclic dependency since #40406 because the attribute support was implemented as part of the AutowirePass (which was surely the right call at the time, but maybe it should have been released with 5.4 :D). Could #40406 be reimplemented using the AttributeAutoconfigurationPass, so that we can restore the CompilerPass ordering that was in place before v5.3.4 ? |
I agree with @Okhoshi, could we restore the compiler pass order like it was in 5.3.4? |
I would be happy to propose a PR giving a more concrete overview of my suggestion. |
… attributes (Okhoshi) This PR was merged into the 5.3 branch. Discussion ---------- [DependencyInjection] Fix autowiring tagged arguments from attributes | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #43272 | License | MIT | Doc PR | no Reimplement #40406 with `AttributeAutoconfigurationPass` to avoid the BC following the change in `CompilerPass` ordering in `PassConfig`. Also revert the various fix made in an attempt to recover the BC introduced by #40406. ~Note: `5.4` branch was needed because `AttributeAutoconfigurationPass` is not handling parameters in 5.3~ To-do: - [x] Add a test to cover the breakage presented in #43272 Commits ------- 4c7566f [DependencyInjection] Fix autowiring tagged arguments from attributes
Symfony version(s) affected: > v5.3.4
Description
There is a breaking change since DependencyInjection was updated (patch version !). It works fine from v5.0.0 to v5.3.4 but newer versions have a breaking change with decorated services. It seems it was introduced #42815 because of the pass order.
How to reproduce
This code works for versions <= v5.3.4 and is breaking for versions > v5.3.4.
Error:
PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "bar.inner". in /.../vendor/symfony/dependency-injection/ContainerBuilder.php:979
Possible Solution
Change the pass order that was changed in #42815 (but if I follow correctly it was made to fix #42791 which was made to fix #42347 because autowire arguments were changed in #40406).
The text was updated successfully, but these errors were encountered: