Skip to content

Commit 2e09e8f

Browse files
author
Robin Chalas
committed
Merge branch '4.4' into 5.0
* 4.4: (38 commits) reset the kernel cache after each test [HttpKernel] Ability to define multiple kernel.reset tags [Routing] Continue supporting single colon in object route loaders [FWBundle] Remove unused parameter [Intl] [Workflow] fixes English grammar typos [Filesystem] [Serializer] fixes English grammar typo mailer: mailchimp bridge is throwing undefined index _id when setting message id in mandrill http transport has_roles should be is_granted in upgrade files [HttpClient] Fix early cleanup of pushed HTTP/2 responses skip test on incompatible PHP versions [HttpKernel] Don't cache "not-fresh" state [FrameworkBundle][Cache] Don't deep-merge cache pools configuration [Messenger] Adding exception to amqp transport in case amqp ext is not installed [SecurityBundle] Don't require a user provider for the anonymous listener [Monolog Bridge] Fixed accessing static property as non static. Improve Symfony description [Mailer] Add UPGRADE entries about Envelope and MessageEvent [FrameworkBundle] fix leftover mentioning "secret:" processor Add DateTimeZoneNormalizer into Dependency Injection [Messenger] Error when specified default bus is not among the configured ...
2 parents 5e6fe63 + 23c4e9b commit 2e09e8f

File tree

8 files changed

+37
-6
lines changed

8 files changed

+37
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ CHANGELOG
3939
* Added new `error_controller` configuration to handle system exceptions
4040
* Added sort option for `translation:update` command.
4141
* [BC Break] The `framework.messenger.routing.senders` config key is not deeply merged anymore.
42-
* Added `secrets:*` commands and `%env(secret:...)%` processor to deal with secrets seamlessly.
42+
* Added `secrets:*` commands to deal with secrets seamlessly.
4343
* Made `framework.session.handler_id` accept a DSN
4444
* Marked the `RouterDataCollector` class as `@final`.
4545
* [BC Break] The `framework.messenger.buses.<name>.middleware` config key is not deeply merged anymore.

Command/ContainerLintCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ private function getContainerBuilder(): ContainerBuilder
7070
if (!$kernel->isDebug() || !(new ConfigCache($kernel->getContainer()->getParameter('debug.container.dump'), true))->isFresh()) {
7171
$buildContainer = \Closure::bind(function () { return $this->buildContainer(); }, $kernel, \get_class($kernel));
7272
$container = $buildContainer();
73-
$container->getCompilerPassConfig()->setRemovingPasses([]);
7473
} else {
7574
(new XmlFileLoader($container = new ContainerBuilder(), new FileLocator()))->load($kernel->getContainer()->getParameter('debug.container.dump'));
7675
}

Command/SecretsListCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6464
{
6565
$io = new SymfonyStyle($input, $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output);
6666

67-
$io->comment('Use <info>"%env(secret:<name>)%"</info> to reference a secret in a config file.');
67+
$io->comment('Use <info>"%env(<name>)%"</info> to reference a secret in a config file.');
6868

6969
if (!$reveal = $input->getOption('reveal')) {
7070
$io->comment(sprintf('To reveal the secrets run <info>php %s %s --reveal</info>', $_SERVER['PHP_SELF'], $this->getName()));

Command/SecretsSetCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected function configure()
5656
<info>%command.full_name% <name></info>
5757
5858
To reference secrets in services.yaml or any other config
59-
files, use <info>"%env(secret:<name>)%"</info>.
59+
files, use <info>"%env(<name>)%"</info>.
6060
6161
By default, the secret value should be entered interactively.
6262
Alternatively, provide a file where to read the secret from:

DependencyInjection/Configuration.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
2020
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
2121
use Symfony\Component\Config\Definition\ConfigurationInterface;
22+
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
2223
use Symfony\Component\DependencyInjection\Exception\LogicException;
2324
use Symfony\Component\Form\Form;
2425
use Symfony\Component\HttpClient\HttpClient;
@@ -877,6 +878,7 @@ private function addCacheSection(ArrayNodeDefinition $rootNode)
877878
->end()
878879
->children()
879880
->arrayNode('adapters')
881+
->performNoDeepMerging()
880882
->info('One or more adapters to chain for creating the pool, defaults to "cache.app".')
881883
->beforeNormalization()
882884
->always()->then(function ($values) {
@@ -1035,6 +1037,10 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
10351037
->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus']; })
10361038
->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
10371039
->end()
1040+
->validate()
1041+
->ifTrue(static function ($v): bool { return isset($v['buses']) && null !== $v['default_bus'] && !isset($v['buses'][$v['default_bus']]); })
1042+
->then(static function (array $v): void { throw new InvalidConfigurationException(sprintf('The specified default bus "%s" is not configured. Available buses are "%s".', $v['default_bus'], implode('", "', array_keys($v['buses'])))); })
1043+
->end()
10381044
->children()
10391045
->arrayNode('routing')
10401046
->normalizeKeys(false)

DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public function load(array $configs, ContainerBuilder $container)
302302
}
303303

304304
if ($this->messengerConfigEnabled = $this->isConfigEnabled($container, $config['messenger'])) {
305-
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['serializer'], $config['validation']);
305+
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['validation']);
306306
} else {
307307
$container->removeDefinition('console.command.messenger_consume_messages');
308308
$container->removeDefinition('console.command.messenger_debug');
@@ -1558,7 +1558,7 @@ private function registerLockConfiguration(array $config, ContainerBuilder $cont
15581558
}
15591559
}
15601560

1561-
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $serializerConfig, array $validationConfig)
1561+
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $validationConfig)
15621562
{
15631563
if (!interface_exists(MessageBusInterface::class)) {
15641564
throw new LogicException('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger".');

Resources/config/serializer.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
<tag name="serializer.normalizer" priority="-915" />
4141
</service>
4242

43+
<service id="serializer.normalizer.datetimezone" class="Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer">
44+
<!-- Run before serializer.normalizer.object -->
45+
<tag name="serializer.normalizer" priority="-915" />
46+
</service>
47+
4348
<service id="serializer.normalizer.dateinterval" class="Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer">
4449
<!-- Run before serializer.normalizer.object -->
4550
<tag name="serializer.normalizer" priority="-915" />

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,27 @@ public function testBusMiddlewareDontMerge()
314314
);
315315
}
316316

317+
public function testItErrorsWhenDefaultBusDoesNotExist()
318+
{
319+
$processor = new Processor();
320+
$configuration = new Configuration(true);
321+
322+
$this->expectException(InvalidConfigurationException::class);
323+
$this->expectExceptionMessage('The specified default bus "foo" is not configured. Available buses are "bar", "baz".');
324+
325+
$processor->processConfiguration($configuration, [
326+
[
327+
'messenger' => [
328+
'default_bus' => 'foo',
329+
'buses' => [
330+
'bar' => null,
331+
'baz' => null,
332+
],
333+
],
334+
],
335+
]);
336+
}
337+
317338
protected static function getBundleDefaultConfig()
318339
{
319340
return [

0 commit comments

Comments
 (0)