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

[DependencyInjection] Can not replace arguments if none have been configured yet - InlineAutowire #54823

Copy link
Copy link
Closed
@soyuka

Description

@soyuka
Issue body actions

Symfony version(s) affected

7.1

Description

Cache clear drops:

  [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException]
  Service "ApiPlatform\Tests\Behat\DoctrineContext": Cannot replace arguments for class "ApiPlatform\Tests\Behat\DoctrineContext" if none have been configured yet.

Exception trace:
  at /symfony/dependency-injection/Definition.php:257
 Symfony\Component\DependencyInjection\Definition->replaceArgument() at /symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:167
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->doResolveDefinition() at /symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:63
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->resolveDefinition() at /symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:46
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /symfony/dependency-injection/Compiler/AbstractRecursivePass.php:84
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:37
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /symfony/dependency-injection/Compiler/AbstractRecursivePass.php:45
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() at /symfony/dependency-injection/Compiler/Compiler.php:73
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /symfony/dependency-injection/ContainerBuilder.php:752
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /symfony/http-kernel/Kernel.php:495
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /symfony/http-kernel/Kernel.php:732
 Symfony\Component\HttpKernel\Kernel->preBoot() at /symfony/http-kernel/Kernel.php:120
 Symfony\Component\HttpKernel\Kernel->boot() at /symfony/http-kernel/Kernel.php:135
 Symfony\Component\HttpKernel\Kernel->reboot() at /symfony/framework-bundle/Command/CacheClearCommand.php:229
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->warmup() at /symfony/framework-bundle/Command/CacheClearCommand.php:141
 Symfony\Bundle\FrameworkBundle\Command\CacheClearCommand->execute() at /symfony/console/Command/Command.php:279
 Symfony\Component\Console\Command\Command->run() at /symfony/console/Application.php:1047
 Symfony\Component\Console\Application->doRunCommand() at /symfony/framework-bundle/Console/Application.php:123
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /symfony/console/Application.php:316
 Symfony\Component\Console\Application->doRun() at /symfony/framework-bundle/Console/Application.php:77
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /symfony/console/Application.php:167
 Symfony\Component\Console\Application->run() at tests/Fixtures/app/console:36

cache:clear [--no-warmup] [--no-optional-warmers]

How to reproduce

git clone git@github.com:api-platform/core
composer config minimum-stability dev
php -d memory_limit=-1 tests/Fixtures/app/console cache:clear --ansi

But actually the service declaration is as simple as:

services:
    _defaults:
        public: false
        autowire: true
        autoconfigure: true

    ApiPlatform\Tests\Behat\DoctrineContext:
        $doctrine: '@doctrine'

Possible Solution

I tracked the bug to:

if ($arguments !== $value->getArguments()) {
$value->setArguments($arguments);
}

Probably that this pass should be done later on? Not sure what AutowireInline actually tries to fix.

If I may also the code change at b9a838e#diff-a0f563695b61a31b6e2bee8d55d019b52326c245667db02ba878a2a878d78b98 should be commented as it's hard to know why the sudden change of testing for . as first char of the service name

Additional Context

No response

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.