bug #22401 [3.2] Prevent double registrations related to tag priorities (nicolas-grekas)

This PR was merged into the 3.2 branch.

Discussion
----------

[3.2] Prevent double registrations related to tag priorities

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

#22396 and #22399 on 3.2

Commits
-------

ec6a2f9eba [3.2] Prevent double registrations related to tag priorities
This commit is contained in:
Fabien Potencier 2017-04-12 09:53:37 -07:00
commit 766ae29f85

View File

@ -40,11 +40,9 @@ trait PriorityTaggedServiceTrait
{
$services = array();
foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $tags) {
foreach ($tags as $attributes) {
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
$services[$priority][] = new Reference($serviceId);
}
foreach ($container->findTaggedServiceIds($tagName) as $serviceId => $attributes) {
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
$services[$priority][] = new Reference($serviceId);
}
if ($services) {