Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DependencyInjection] Regression in sorting service locators by priority #57344

Closed
@longwave

Description

@longwave

Symfony version(s) affected

>=7.0.0

Description

#42506 requested that service locators were sorted by priority. This was implemented in #42532 but broken in Symfony 7.0 in #50578.

The test coverage for this was incorrectly switched to the wrong order in cc4ef49#diff-2d095e6b8882e9c562ea8541b1c0c995b8fd438946e73b4bd4a74f9895a47366L215-R215

Similar changes to IntegrationTest also show this regression: cc4ef49#diff-4440c0daf07aa75a97e4cf9f147391d566ebaa04fe772bdf1c896f92f6292f38

How to reproduce

In ServiceLocatorTagPassTest, change the assertion back to

        static::assertSame(['service-2', 'service-1'], array_keys($factories));

Possible Solution

Remove the ksort() in ServiceLocatorTagPass::map().

Additional Context

This was discovered when trying to use priority ordered service locators in Drupal in https://www.drupal.org/project/drupal/issues/3436295

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