Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[FrameworkBundle] "Ghost" services when excluding non-matches #48607

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
apfelbox opened this issue Dec 12, 2022 · 3 comments
Closed

[FrameworkBundle] "Ghost" services when excluding non-matches #48607

apfelbox opened this issue Dec 12, 2022 · 3 comments

Comments

@apfelbox
Copy link
Contributor

apfelbox commented Dec 12, 2022

Symfony version(s) affected

6.2.1

Description

I have a bundle with a service MyBundle\SystemInformation\SystemInformation that I would like to include.
So I now edit my services.yaml and add an invalid exclusion rules, as I forgot the star:

services:
    _defaults:
        autoconfigure: true
        autowire: true

    MyBundle\:
        resource: ../src/*
        exclude:
            - ../src/SystemInformation #oops

If I now do a debug:container in the main application, it lists a non-existant service:

CleanShot 2022-12-12 at 11 52 59

CleanShot 2022-12-12 at 11 53 19

One thing to not here is that the original service is gone now. So maybe the dummy excluded service that is added due to #46279 just uses the wrong id?

How to reproduce

See above

Possible Solution

This will be fixed if #48606 is implemented. Not sure if this has more consequences somewhere else.

Additional Context

No response

@nicolas-grekas
Copy link
Member

Does #48606 fix this one?

@apfelbox
Copy link
Contributor Author

@nicolas-grekas can't reproduce right now, so seems to be fixed.

@shude
Copy link
Contributor

shude commented Dec 22, 2022

I catch this issue now too. I will say more, ghost services appear not only with a non-existent exclusion path, but also in general on any folder that we exclude. For example:

    App\:
        resource: ../src/*
        exclude:
            - '../src/Dto/'
            - '../src/Entity/'

If excluded paths is exists then we have two ghost services in a container:

Serivece ID                                               Class name
App\Dto                                                    App\Dto
App\Entity                                                 App\Entity

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

4 participants