8000 [Bug][BC break][DependencyInjection] Resolve arguments of service broken in 4.2 · Issue #29412 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[Bug][BC break][DependencyInjection] Resolve arguments of service broken in 4.2 #29412

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
peterrehm opened this issue Dec 1, 2018 · 3 comments

Comments

@peterrehm
Copy link
Contributor

Symfony version(s) affected: 4.2

Description
After the upgrade from 4.1 to 4.2 I am getting the error:

'The service "twig" has a dependency on a non-existent service "mopa_bootstrap.navbar_renderer".'

This is due to the following service definition in an external bundle:

services:
    mopa_bootstrap.navbar_renderer:
        class: Mopa\Bundle\BootstrapBundle\Navbar\Renderer\NavbarRenderer
        arguments: [ '@service_container', [] ]
        tags:
            # The alias is what is used to retrieve the menu
            - { name: knp_menu.renderer, alias: navbar }

    mopa_bootstrap.navbar.twig.extension:
        class: Mopa\Bundle\BootstrapBundle\Navbar\Twig\NavbarExtension
        arguments: [ '@mopa_bootstrap.navbar_renderer' ]
        tags:
            -  { name: twig.extension }

If I add public: true to mopa_bootstrap.navbar_renderer it works as expected.
This seems strange as it is properly injected. Any idea?

How to reproduce

Possible Solution

Additional context

peterrehm added a commit to peterrehm/MopaBootstrapBundle that referenced this issue Dec 1, 2018
@tgalopin
Copy link
Contributor
tgalopin commented Dec 1, 2018

#29393 may have fixed the problem, could you apply the patch and try building the container? If it's working as expected, the next patch release will include the fix.

@peterrehm
Copy link
Contributor Author
peterrehm commented Dec 2, 2018

I have just tried it and it fixes the issue with the specific bundle but new issues are arising.

Now I am getting the error:

You have requested a non-existent service "security.authentication.session_strategy.api".

This seems to be realted with my api section of the firewall:

security:
   firewalls:
        api:
            pattern:    ^/api
            simple-preauth:
                provider: fos_userbundle
                authenticator: App\Security\AuthTokenAuthenticator
            anonymous: ~
            stateless: true

If I remove the api section of the firewalls the error changes to

You have requested a non-existent service "router.default".

I am seeing the errors during cache:clear even after a full removal of the cache directory.

@peterrehm peterrehm changed the title [Bug][DependencyInjection] Resolve arguments of service broken in 4.2 [Bug][BC break][DependencyInjection] Resolve arguments of service broken in 4.2 Dec 2, 2018
nicolas-grekas added a commit that referenced this issue Dec 2, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] dont inline when lazy edges are found

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

I'm not able to create a reproducer to hit this situation, but on 4.2, this check makes the difference.
I'm merging to fix the issue as that's still the proper fix.

Commits
-------

484c49e [DI] dont inline when lazy edges are found
@peterrehm
Copy link
Contributor Author

@nicolas-grekas Thanks, looks fixed.

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
0