File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -998,10 +998,14 @@ public function findDefinition($id)
998
998
$ id = (string ) $ this ->aliasDefinitions [$ id ];
999
999
1000
1000
if (isset ($ seen [$ id ])) {
1001
- throw new ServiceCircularReferenceException ($ id , array_keys ($ seen ));
1001
+ $ seen = array_values ($ seen );
1002
+ $ seen = array_slice ($ seen , array_search ($ id , $ seen ));
1003
+ $ seen [] = $ id ;
1004
+
1005
+ throw new ServiceCircularReferenceException ($ id , $ seen );
1002
1006
}
1003
1007
1004
- $ seen [$ id ] = true ;
1008
+ $ seen [$ id ] = $ id ;
1005
1009
}
1006
1010
1007
1011
return $ this ->getDefinition ($ id );
Original file line number Diff line number Diff line change @@ -1046,18 +1046,19 @@ public function testInlinedDefinitions()
1046
1046
1047
1047
/**
1048
1048
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException
1049
- * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass".
1049
+ * @expectedExceptionMessage Circular reference detected for service "app.test_class", path: "app.test_class -> App\TestClass -> app.test_class ".
1050
1050
*/
1051
1051
public function testThrowsCircularExceptionForCircularAliases ()
1052
1052
{
1053
1053
$ builder = new ContainerBuilder ();
1054
1054
1055
1055
$ builder ->setAliases (array (
1056
+ 'foo ' => new Alias ('app.test_class ' ),
1056
1057
'app.test_class ' => new Alias ('App \\TestClass ' ),
1057
1058
'App \\TestClass ' => new Alias ('app.test_class ' ),
1058
1059
));
1059
1060
1060
- $ builder ->findDefinition ('App \\ TestClass ' );
1061
+ $ builder ->findDefinition ('foo ' );
1061
1062
}
1062
1063
1063
1064
public function testInitializePropertiesBeforeMethodCalls ()
You can’t perform that action at this time.
0 commit comments