Skip to content

Fatal error in RemoveUnusedDefinitionsPass when building container with injected services #27802

@ciaranmcnulty

Description

@ciaranmcnulty

Symfony version(s) affected: dev-master

Description
Changes to inlining introduced in #27471 have broken Behat's CLI app.

The services available here:
https://github.com/Behat/Behat/blob/master/src/Behat/Testwork/Cli/Application.php#L181-L182
...are triggering a fatal error inside the RemoveUnusedDefinitionsPass when building the main application service.

Even if Behat is using the DIC wrongly, this probably shouldn't be causing a fatal at this point.

I'll update this issue if I manage to extract a smaller reproducible bug

Stack trace:

In ContainerBuilder.php line 1001:
                                                                              
  [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]  
  You have requested a non-existent service "cli.output".                     
                                                                              
Exception trace:
 Symfony\Component\DependencyInjection\ContainerBuilder->getDefinition() at /Users/ciaran/Code/Behat/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php:65
 Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass->process() at /Users/ciaran/Code/Behat/vendor/symfony/dependency-injection/Compiler/Compiler.php:95
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Users/ciaran/Code/Behat/vendor/symfony/dependency-injection/ContainerBuilder.php:736
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Users/ciaran/Code/Behat/src/Behat/Testwork/Cli/Application.php:187
 Behat\Testwork\Cli\Application->createContainer() at /Users/ciaran/Code/Behat/src/Behat/Testwork/Cli/Application.php:161
 Behat\Testwork\Cli\Application->createCommand() at /Users/ciaran/Code/Behat/src/Behat/Testwork/Cli/Application.php:122
 Behat\Testwork\Cli\Application->doRun() at /Users/ciaran/Code/Behat/vendor/symfony/console/Application.php:145
 Symfony\Component\Console\Application->run() at /Users/ciaran/Code/Behat/bin/behat:34

How to reproduce

composer create-project behat/behat behat-debug
cd !$
composer config minimum-stability dev
composer update
bin/behat

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy