Skip to content

Commit 6b90960

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: #17676 - making the proxy instantiation compatible with ProxyManager 2.x by detecting proxy features Fix bug when using an private aliased factory service ChoiceFormField of type "select" could be "disabled" Update contributing docs [Console] Fix escaping of trailing backslashes Fix constraint validator alias being required [ci] clone with depth=1 to kill push-forced PRs Add check on If-Range header
2 parents 3d7b872 + fc821a7 commit 6b90960

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Compiler/ReplaceAliasByActualDefinitionPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function updateFactoryServiceReference($factoryService, $currentId, $new
132132
return;
133133
}
134134

135-
return $currentId === $factoryService ? $newId : $currentId;
135+
return $currentId === $factoryService ? $newId : $factoryService;
136136
}
137137

138138
private function updateFactoryReference($factory, $currentId, $newId)

Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
use Symfony\Component\DependencyInjection\Definition;
1717
use Symfony\Component\DependencyInjection\Reference;
1818

19+
require_once __DIR__.'/../Fixtures/includes/foo.php';
20+
1921
class ReplaceAliasByActualDefinitionPassTest extends \PHPUnit_Framework_TestCase
2022
{
2123
public function testProcess()
@@ -50,6 +52,26 @@ public function testProcess()
5052
$this->assertSame('b_alias', (string) $resolvedFactory[0]);
5153
}
5254

55+
/**
56+
* @group legacy
57+
*/
58+
public function testPrivateAliasesInFactory()
59+
{
60+
$container = new ContainerBuilder();
61+
62+
$container->register('a', 'FooClass');
63+
$container->register('b', 'FooClass')
64+
->setFactoryService('a')
65+
->setFactoryMethod('getInstance');
66+
67+
$container->register('c', 'stdClass')->setPublic(false);
68+
$container->setAlias('c_alias', 'c');
69+
70+
$this->process($container);
71+
72+
$this->assertInstanceOf('FooClass', $container->get('b'));
73+
}
74+
5375
/**
5476
* @expectedException \InvalidArgumentException
5577
*/

0 commit comments

Comments
 (0)