-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
AbstractController and non-shared service break in test environment #29628
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 create a small example application that allows to reproduce the issue? |
@xabbuh done. While creating it, I discovered a connection with a custom Twig Extension in which the same non-shared service is injected. If you remove the 'PrismicExtension', the test environment shows no error. The application is set to 'test' in .env. Change it to 'dev' to see a working one. |
I managed to reproduce and try to debug your example application a bit. The issue seems to reside somewhere in the process of inlining services inside |
@xabbuh is this issue waiting for my feedback or is someone else currently assigned to try to find the cause for this problem? |
The bug is confirmed. But so far nobody cared enough (or at least didn't comment here) to look into the cause and try to fix it. |
…m (nicolas-grekas) This PR was merged into the 4.2 branch. Discussion ---------- [DI] fix removing non-shared definition while inlining them | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29628 | License | MIT | Doc PR | - I didn't manage to create a specific test case but this still has 100% coverage for the added lines and fixed the reproducer (and makes sense also :) ) Commits ------- 317e820 [DI] fix removing non-shared definition while inlining them
Symfony version(s) affected: 4.2.x
Description
Since v4.2.x, symfony shows a deprecation warning about not using the Symfony\Bundle\FrameworkBundle\Controller\AbstractController but Symfony\Bundle\FrameworkBundle\Controller\Controller. After changing all controllers to extend the abstract version, the test environment breaks when there is a non-shared service in use.
How to reproduce
Create a service and configure it as non-shared.
Inject the service in a controller:
Now, when calling the console
the following error is shown:
Additional context
When I have 2 controllers, one which doesn't inject LinkResolverServiceInterface and one that does. The error is also triggered if only the controller without the injection extends the AbstractController.
The text was updated successfully, but these errors were encountered: