Skip to content
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

[DIC] Error when a service cannot boot: we unregister the wrong service #54728

Open
lyrixx opened this issue Apr 25, 2024 · 0 comments
Open

[DIC] Error when a service cannot boot: we unregister the wrong service #54728

lyrixx opened this issue Apr 25, 2024 · 0 comments

Comments

@lyrixx
Copy link
Member

lyrixx commented Apr 25, 2024

Symfony version(s) affected

5.4

Description

  1. I boot service A
  2. It needs service B
  3. Service B cannot be boot
  4. => Symfony unset service A But it should be service B

How to reproduce

See this commit

$ bin/console app:twig-is-broken

                                                                                                                        
 [WARNING] Some commands could not be registered:                                                                       
                                                                                                                        

In IWillBreakTwigExtension.php line 11:
                                  
  I Broke twig but partially :(!  
                                  


                                                                                                                        
 [WARNING] Some commands could not be registered:                                                                       
                                                                                                                        

In IWillBreakTwigExtension.php line 11:
                                  
  I Broke twig but partially :(!  
                                  

^ "Twig\Extension\CoreExtension"
^ "Twig\Extension\EscaperExtension"
^ "Twig\Extension\YieldNotReadyExtension"
^ "Twig\Extension\OptimizerExtension"
^ "Symfony\Bridge\Twig\Extension\CsrfExtension"
^ "Symfony\Bridge\Twig\Extension\DumpExtension"
^ "Symfony\Bridge\Twig\Extension\ProfilerExtension"
^ "Symfony\Bridge\Twig\Extension\TranslationExtension"
^ "Symfony\Bridge\Twig\Extension\AssetExtension"
^ "Symfony\Bridge\Twig\Extension\CodeExtension"
^ "Symfony\Bridge\Twig\Extension\RoutingExtension"
^ "Symfony\Bridge\Twig\Extension\YamlExtension"
^ "Symfony\Bridge\Twig\Extension\StopwatchExtension"
^ "Symfony\Bridge\Twig\Extension\ExpressionExtension"
^ "Symfony\Bridge\Twig\Extension\HttpKernelExtension"
^ "Symfony\Bridge\Twig\Extension\HttpFoundationExtension"
^ "Symfony\Bridge\Twig\Extension\WebLinkExtension"
^ "Symfony\Bridge\Twig\Extension\SerializerExtension"
^ "Symfony\Bridge\Twig\Extension\FormExtension"
^ "Symfony\Bridge\Twig\Extension\LogoutUrlExtension"
^ "Symfony\Bridge\Twig\Extension\SecurityExtension"
  1. I was able to boot my command
  2. twig was loaded, but partially; It misses some extensions

Possible Solution

Issue is here

unset($container->services[$id]);

It's not the good ID.

Additional Context

I noticed that, when I try to run bin/console lint:twig => Some extension were missing (like path, url, etc)

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

3 participants