10000 bug #22399 [2.8] Prevent double registrations related to tag prioriti… · symfony/symfony@d564c6a · GitHub
[go: up one dir, main page]

Skip to content

Commit d564c6a

Browse files
committed
bug #22399 [2.8] Prevent double registrations related to tag priorities (nicolas-grekas)
This PR was merged into the 2.8 branch. Discussion ---------- [2.8] Prevent double registrations related to tag priorities | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - #22396 on 2.8 Commits ------- 2be5821 [2.8] Prevent double registrations related to tag priorities
2 parents c839532 + 2be5821 commit d564c6a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/PropertyInfoPass.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container
5757
$services = $container->findTaggedServiceIds($tagName);
5858

5959
$sortedServices = array();
60-
foreach ($services as $serviceId => $tags) {
61-
foreach ($tags as $attributes) {
62-
$priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
63-
$sortedServices[$priority][] = new Reference($serviceId);
64-
}
60+
foreach ($services as $serviceId => $attributes) {
61+
$priority = isset($attributes[0]['priority']) ? $attributes[0]['priority'] : 0;
62+
$sortedServices[$priority][] = new Reference($serviceId);
6563
}
6664

6765
if (empty($sortedServices)) {

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/PropertyInfoPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class PropertyInfoPassTest extends TestCase
2020
public function testServicesAreOrderedAccordingToPriority()
2121
{
2222
$services = array(
23-
'n3' => array('tag' => array()),
24-
'n1' => array('tag' => array('priority' => 200)),
25-
'n2' => array('tag' => array('priority' => 100)),
23+
'n3' => array(array()),
24+
'n1' => array(array('priority' => 200)),
25+
'n2' => array(array('priority' => 100)),
2626
);
2727

2828
$expected = array(

0 commit comments

Comments
 (0)
0