Skip to content

[DependencyInjection][4.0] Private services are removed from compiled container #25242

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
Jean85 opened this issue Dec 1, 2017 · 6 comments
Closed

Comments

@Jean85
Copy link
Contributor

Jean85 commented Dec 1, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? unsure
RFC? no
Symfony version 4.0.0

The DI component is acting weird in 4.0.0. I'm currently working on facile-it/paraunit#112 to allow Symfony 4, and the build is broken only with Symfony 4, no deprecations on 3.4.

I've already fixed the private/public service deprecations, and I'm currently debugging the issue. I found the root cause in the RemoveUnusedDefinitionsPass: many private services are considered unused and so removed from the DI. Maybe it's because they are inlined? If that's true, I'm not able to make them public in tests afterward to retrieve and inspect them.

@Jean85
Copy link
Contributor Author

Jean85 commented Dec 1, 2017

@nicolas-grekas maybe this has the same root cause of #25240?

@nicolas-grekas
Copy link
Member

Fixed in #25244
That's just a missing deprecation.

@Jean85
Copy link
Contributor Author

Jean85 commented Dec 1, 2017

Umh no this is not my case @nicolas-grekas... I have this issue in the tests, where I re-set services as public for testing purpose.

I understand that the inlining brings a lot of performance optimizations, but can I disable it in some way? Otherwise I would have to move this stuff before the container compilation, but I think it may change the outcome of my test, hiding possible service visibility issues.

@nicolas-grekas
Copy link
Member

The linked patch is wrong: making a service public after compilation is a no-op/dead code basically.
You need to move that to a compiler pass, or better: create public aliases for tests.
See #24543

@Jean85
Copy link
Contributor Author

Jean85 commented Dec 1, 2017

The linked patch is wrong: making a service public after compilation is a no-op/dead code basically.

Ok, good to know. Maybe we should deprecate/throw an error there?

You need to move that to a compiler pass, or better: create public aliases for tests.

I'll try, thanks for the suggestion.

@fabpot fabpot closed this as completed Dec 1, 2017
fabpot added a commit that referenced this issue Dec 1, 2017
…s from ContainerBuilder (nicolas-grekas)

This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Add missing deprecation when fetching private services from ContainerBuilder

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #25242
| License       | MIT
| Doc PR        | -

Commits
-------

93c0b38 [DI] Add missing deprecation when fetching private services from ContainerBuilder
@nicolas-grekas
Copy link
Member

Please check #26499

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants