Closed
Description
Symfony version(s) affected
6.2.4
Description
Since some bundles are not loaded in PROD (e.g. DebugBundle
or WebProfilerBundle
), the dependency injection for their PHP config files is not working (since their *Config
class is not generated).
How to reproduce
config/packages/debug.php
:
<?php declare(strict_types=1);
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Config\DebugConfig;
use function Symfony\Component\DependencyInjection\Loader\Configurator\env;
return static function (DebugConfig $debugConfig, ContainerConfigurator $containerConfigurator): void {
if ('dev' === $containerConfigurator->env()) {
$debugConfig->dumpDestination('tcp://' . env('VAR_DUMPER_SERVER')->string());
}
};
config/bundles.php
:
<?php declare(strict_types = 1);
return [
// ...
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
];
Then running APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear
results in this error:
Could not resolve argument "Symfony\Config\DebugConfig $debugConfig"
There is no extension able to load the configuration for "Symfony\Config\DebugConfig". Looked for namespace "debug", found "framework", "doctrine", ...
Possible Solution
No response
Additional Context
No response