-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DI] Fix returning NULL on invalid ref for synthetic services #19847
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
Conversation
nicolas-grekas
commented
Sep 4, 2016
Q | A |
---|---|
Branch? | 2.7 |
Bug fix? | yes |
Tests pass? | yes |
Fixed tickets | #19689 #19840 #19825 |
License | MIT |
Doc PR | - |
Unfortunately this does not fix #19840 for me |
@dmaicher the code you posted is broken: it misses the |
why exactly? I mean as long as I'm in the request scope it should be safe to retrieve the request service, right? I mean it worked with symfony So as far as I can see the problem is that here https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php#L82 the request is set to null which then triggers |
I checked a bit more to understand how @dmaicher you should send a PR on https://github.com/craue/CraueFormFlowBundle/blob/2.1.9/Resources/config/form_flow.xml#L29 to add |
But technically as long as I'm in request scope I will always be able to retrieve the Isn't this a BC break how the behaviour of the container changed for setting service instances to |
@fabpot @stof I'd be happy to have your input here:
In both cases, this is untested behavior. This PR adds a test for 1. |
I guess we should revert yes. This issue is gone on 3.0 since scopes are gone also. |
…" (nicolas-grekas) This PR was merged into the 2.7 branch. Discussion ---------- Revert "minor #19689 [DI] Cleanup array_key_exists (ro0NL)" | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | Tests pass? | yes | Fixed tickets | #19689 #19840 #19825 #19857 | License | MIT | Doc PR | - This reverts commit c89f80a, reversing changes made to 386e5e7. See discussion in #19847 I'll try adding test cases soon that ensure that: - [x] *when not leaving scope* synthetic services always throw and ignore the `ContainerInterface::NULL_ON_INVALID_REFERENCE` flag (on 3.x also) - [x] *when leaving scope* synthetic services always return null and ignore the `ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE` (until 2.8 since scopes are gone in 3.x) Commits ------- 8cb28bf [DI] Add anti-regression test ac742df Revert "minor #19689 [DI] Cleanup array_key_exists (ro0NL)"