Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a0d66d2

Browse filesBrowse files
committed
bug #39686 [Lock] Fix config merging in lock (jderusse)
This PR was merged into the 4.4 branch. Discussion ---------- [Lock] Fix config merging in lock | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #35920 | License | MIT | Doc PR | - Commits ------- 6bb2d67 Fix config merging in lock
2 parents 04c67e6 + 6bb2d67 commit a0d66d2
Copy full SHA for a0d66d2

File tree

2 files changed

+31
-0
lines changed
Filter options

2 files changed

+31
-0
lines changed

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,8 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11221122
->fixXmlConfig('resource')
11231123
->children()
11241124
->arrayNode('resources')
1125+
->normalizeKeys(false)
1126+
->useAttributeAsKey('name')
11251127
->requiresAtLeastOneElement()
11261128
->defaultValue(['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']])
11271129
->beforeNormalization()
@@ -1144,6 +1146,7 @@ private function addLockSection(ArrayNodeDefinition $rootNode)
11441146
})
11451147
->end()
11461148
->prototype('array')
1149+
->performNoDeepMerging()
11471150
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
11481151
->prototype('scalar')->end()
11491152
->end()

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,34 @@ public function provideValidLockConfigurationTests()
250250
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
251251
}
252252

253+
public function testLockMergeConfigs()
254+
{
255+
$processor = new Processor();
256+
$configuration = new Configuration(true);
257+
$config = $processor->processConfiguration($configuration, [
258+
[
259+
'lock' => [
260+
'payload' => 'flock',
261+
],
262+
],
263+
[
264+
'lock' => [
265+
'payload' => 'semaphore'
266+
],
267+
],
268+
]);
269+
270+
$this->assertEquals(
271+
[
272+
'enabled' => true,
273+
'resources' => [
274+
'payload' => ['semaphore']
275+
],
276+
],
277+
$config['lock']
278+
);
279+
}
280+
253281
public function testItShowANiceMessageIfTwoMessengerBusesAreConfiguredButNoDefaultBus()
254282
{
255283
$expectedMessage = 'You must specify the "default_bus" if you define more than one bus.';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.