Skip to content

[DependencyInjection] Named arguments not longer working like expected #49074

@alexander-schranz

Description

@alexander-schranz

Symfony version(s) affected

>=5.4@dev (tagged versions and 4.4-dev working)

Description

It seems like since #48818 and the fix #48926 the named arguments are not longer working like expected.

The failing service definition is:

https://github.com/sulu/sulu/blob/08863981d9e607dd1432db68eec2dac710732f74/src/Sulu/Bundle/CoreBundle/Resources/config/content.xml#L45-L49

        <service id="sulu.content.path_cleaner" class="%sulu.content.path_cleaner.class%" public="true">
            <argument type="collection" key="$replacers">
            </argument>
            <argument type="service" key="$slugger" id="sulu.content.slugger"/>
        </service>

How to reproduce

git clone git@github.com:sulu/sulu.git
cd sulu
git checkout 2.4

# dev stability required issue currently only on 5.4-dev 6-x.dev (4.4 and stable tagged versions works)
composer config minimum-stability dev
composer update

bin/runtests -t RouteBundle -C --flags="--filter=RouteControllerTest::testGenerate --stop-on-failure"

Output:

Sulu\Bundle\RouteBundle\Tests\Functional\Controller\RouteControllerTest::testGenerateWithConflictSameEntity
Error: Unknown named parameter $$replacers

/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1109
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:608
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1232
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1180
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1078
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:608
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1232
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1180
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:1078
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:608
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:553
/private/tmp/sulu/src/Sulu/Bundle/RouteBundle/DependencyInjection/RouteGeneratorCompilerPass.php:52
/private/tmp/sulu/vendor/symfony/dependency-injection/Compiler/Compiler.php:82
/private/tmp/sulu/vendor/symfony/dependency-injection/ContainerBuilder.php:757
/private/tmp/sulu/vendor/symfony/http-kernel/Kernel.php:546
/private/tmp/sulu/vendor/symfony/http-kernel/Kernel.php:787
/private/tmp/sulu/vendor/symfony/http-kernel/Kernel.php:128
/private/tmp/sulu/vendor/symfony/framework-bundle/Test/KernelTestCase.php:82
/private/tmp/sulu/vendor/symfony/framework-bundle/Test/WebTestCase.php:46
/private/tmp/sulu/src/Sulu/Bundle/TestBundle/Testing/CreateClientTrait.php:31
/private/tmp/sulu/src/Sulu/Bundle/RouteBundle/Tests/Functional/Controller/RouteControllerTest.php:41

Possible Solution

Additional Context

I tested out the current released version 5.4.18 and there it seems to work so I think it has todo with @nicolas-grekas changes in #48926.

I created a breakpoint and could find out that it has todo with the key="$replacers" service definition:
https://github.com/sulu/sulu/blob/08863981d9e607dd1432db68eec2dac710732f74/src/Sulu/Bundle/CoreBundle/Resources/config/content.xml#L45-L49

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