Skip to content

Commit 6c3082a

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Prevent double registrations related to tag priorities
2 parents ff6cd64 + 5d3ff12 commit 6c3082a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

DependencyInjection/Compiler/SerializerPass.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
}
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
krsort($sortedServices);

Tests/DependencyInjection/Compiler/SerializerPassTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public function testThrowExceptionWhenNoEncoders()
7272
public function testServicesAreOrderedAccordingToPriority()
7373
{
7474
$services = array(
75-
'n3' => array('tag' => array()),
76-
'n1' => array('tag' => array('priority' => 200)),
77-
'n2' => array('tag' => array('priority' => 100)),
75+
'n3' => array(array()),
76+
'n1' => array(array('priority' => 200)),
77+
'n2' => array(array('priority' => 100)),
7878
);
7979

8080
$expected = array(

0 commit comments

Comments
 (0)