-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
Symfony version(s) affected
6.3
Description
By upgrading from 6.2 to 6.3, services implemente an registerForAutoconfiguration()
interface with negative priority are not sorted correctly.
This seems happen only when $needsIndexes
is set to true (see below).
How to reproduce
- Define a tagged service with a negative priority
$services
->set(MyService::class)->tag('controller.argument_value_resolver', ['priority' => -70]);
ValueResolverInterface
isregisterForAutoconfiguration
- Now
ControllerArgumentValueResolverPass
callfindAndSortTaggedServices()
with aTaggedIteratorArgument
and$needsIndexes
totrue
instead of a simplestring
.
The behavior of this method is changed and instead of register service only once bycontinue 2
, the service is registered twice one with -70 priority and one with 0 priority. uasort()
sort the service with priority 0 before the -70 one (normal)- The
$refs
construction add the priority 0 first and the -70 only rewrite it.
Possible Solution
Locally, I need to register my service with autoconfigure(false)
.
$services
->set(MyService::class)->autoconfigure(false)->tag('controller.argument_value_resolver', ['priority' => -70]);
Additional Context
No response
FrancoisPog and Piou-piou