Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

lint:container does not correctly validate tagged services in debug mode #53839

Open
@DCoderLT

Description

@DCoderLT

Symfony version(s) affected

6.3

Description

When the console commandlint:container is invoked in debug mode, it recompiles the container with many compiler passes removed, includingResolveTaggedIteratorArgumentPass andServiceLocatorTagPass. As a result,RemoveUnusedDefinitionsPass sees no references to tagged services and removes them as “unused”, unless those services are made public or otherwise referenced in the container. After those services are removed, theCheckTypeDeclarationsPass pass does not see them and does not validate them.
The command behaves correctly in non-debug mode, but this is quite surprising and non-obvious.

How to reproduce

  • create a service that uses!tagged_iterator to find its supporting services
  • create another service, tag it so the first service will find it
  • intentionally configure incorrect arguments for this second service
  • run thelint:container console command
  • observe that it did not detect those incorrect arguments
  • mark the second service as public
  • re-runlint:container
  • observe that incorrect arguments are now correctly detected

Repro example:https://github.com/DCoderLT/symfony_issue_53839 , the last service in config/services.yaml is configured incorrectly, butlint:container does not detect it.

Possible Solution

If I add theResolveTaggedIteratorArgumentPass andServiceLocatorTagPass passes back into the linter command, the tagged services no longer get removed, so the bug gets fixed. But I am sure those passes were removed for a reason, and I don’t know if they depend on any other passes that have also been excluded from this command. So I am reluctant to suggest “add those two passes” as a complete/correct fix.
RemovingRemoveUnusedDefinitionsPass also doesn’t seem like the correct fix.

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp