Description
Symfony version(s) affected
7.1.0
Description
Since Symfony 7.1 prependExtension
with $container->import
ignores the passed configuration.
In documentation it is mentioned:
Starting from Symfony 7.1, calling the import() method inside prependExtension() will prepend the given configuration. In previous Symfony versions, this method appended the configuration.
But the configuration of the file is completely ignored.
As example we use a bundle to share configuration for the messenger component.
Part of output of bin/console debug:config framework
with symfony/dependency-injection: ^7.1
messenger:
enabled: true
routing: { }
serializer:
default_serializer: messenger.transport.native_php_serializer
symfony_serializer:
format: json
context: { }
transports: { }
Part of output of bin/console debug:config framework
with symfony/dependency-injection: <7.1
messenger:
serializer:
default_serializer: messenger.transport.symfony_serializer
symfony_serializer:
format: json
context: { }
transports:
example:
dsn: '%env(RABBITMQ_URL)%/%2f/messages'
options:
exchange:
name: example.exchange
type: direct
queues:
example.queue:
binding_keys:
- example
serializer: null
failure_transport: null
retry_strategy:
service: null
max_retries: 3
delay: 1000
multiplier: 2
max_delay: 0
rate_limiter: null
How to reproduce
A bundle wich imports a PHP config file.
// src/ExampleBundle.php
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
class ExampleBundle extends AbstractBundle
{
public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): void
{
$container->import('../config/packages/messenger.php');
}
Example config file:
// config/packages/messenger.php
return static function (FrameworkConfig $framework, ContainerConfigurator $container): void {
$messenger = $framework->messenger();
$messenger
->transport('example')
->dsn(env('RABBITMQ_URL') . '/%2f/messages')
->options([
'exchange' => [
'name' => 'example.exchange',
'type' => 'direct',
],
'queues' => [
'example.queue' => [
'binding_keys' => ['example']
],
],
])
;
Possible Solution
No response
Additional Context
No response