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

[Messenger] Messenger transport options are merged with numbers as keys #39846

Copy link
Copy link
Closed
@svitiashchuk

Description

@svitiashchuk
Issue body actions

Symfony version(s) affected: 4.4

Description
Messenger config options array merged wrong. Values inside specific environment config of options array are merged to common config with numbers as keys.

How to reproduce

  1. Create messenger.yaml in config/packages/ with following contents:
framework:
    messenger:
        transports:
            async: "%env(MESSENGER_TRANSPORT_DSN)%"
            options:
                auto_setup: false
  1. Then, create another, for example, for the test environment config/packages/test/ and add options there:
framework:
    messenger:
        transports:
            async: "%env(MESSENGER_TRANSPORT_DSN)%"
            options:
                wait_time: 60
  1. Run console debug:config:
console debug:config framework
#...
messenger:
    transports:
        async:
            dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
            options:
                auto_setup: true
#...
  1. Run console debug:config for test-environment:
APP_ENV=test console debug:config framework

Output for test-environment:

#...
messenger:
    transports:
        async:
            dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
            options:
                auto_setup: true
                0: 60
#...

Additional context

That's happened because in ConfigTree options are defined as arrayNode and has a prototype('variable'). So for combining config together PrototypedArrayNode::mergeValues() would be called. And there is an issue. For those PrototypedArrayNode that have not $keyAttribute $rightSide values added without keys:

foreach ($rightSide as $k => $v) {
    // prototype, and key is irrelevant, append the element
    if (null === $this->keyAttribute) {
        $leftSide[] = $v;
        continue;
    }

Possible soultion
So the solution is to add useAttributeAsKey inside ConfigTree for arrayNode('options'). PR will be submitted soon

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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