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 c799fc8

Browse filesBrowse files
committed
bug #32380 [Messenger] fix broken key normalization (Tobion)
This PR was merged into the 4.3 branch. Discussion ---------- [Messenger] fix broken key normalization | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | | License | MIT | Doc PR | Disable broken key normalization in messenger config. If you tried to use `-` in a transport/bus it didn't work and you get a cryptic error (#31613) ``` framework: messenger: transports: my-bus: '...' routing: Acme\MyMessage: my-bus ``` The default behavior of normalizing keys is really annoying and a waste of time in most cases. I've measured `\Symfony\Component\Config\Definition\ArrayNode::preNormalize` in a project and it takes 4 ms. As an idea, we could disabling normalizing keys automatically when you call `useAttributeAsKey` because the value is then user-provided and shouldn't be modified (in contrast to children properties of an arrayNode which should get normalized for xml support). Commits ------- 9931b3e [Messenger] fix broken key normalization
2 parents 511fc93 + 9931b3e commit c799fc8
Copy full SHA for c799fc8

File tree

Expand file treeCollapse file tree

1 file changed

+3
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-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
@@ -1114,6 +1114,7 @@ private function addMessengerSection(ArrayNodeDefinition $rootNode)
11141114
->end()
11151115
->children()
11161116
->arrayNode('routing')
1117+
->normalizeKeys(false)
11171118
->useAttributeAsKey('message_class')
11181119
->beforeNormalization()
11191120
->always()
@@ -1173,6 +1174,7 @@ function ($a) {
11731174
->end()
11741175
->end()
11751176
->arrayNode('transports')
1177+
->normalizeKeys(false)
11761178
->useAttributeAsKey('name')
11771179
->arrayPrototype()
11781180
->beforeNormalization()
@@ -1220,6 +1222,7 @@ function ($a) {
12201222
->scalarNode('default_bus')->defaultNull()->end()
12211223
->arrayNode('buses')
12221224
->defaultValue(['messenger.bus.default' => ['default_middleware' => true, 'middleware' => []]])
1225+
->normalizeKeys(false)
12231226
->useAttributeAsKey('name')
12241227
->arrayPrototype()
12251228
->addDefaultsIfNotSet()

0 commit comments

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