Skip to content

Commit 761e51a

Browse files
committed
Merge branch '3.2' into 3.3
* 3.2: [Security] Fix wrong term in UserProviderInterface [HttpFoundation] Set meta refresh time to 0 in RedirectResponse content disable inlining deprecated services [Cache] add constructor docblocks for clarity [Security] validate empty passwords again [DI] Remove irrelevant comment from container [TwigBridge] cleaner implementation of the TwigRenderer
2 parents dde518c + c1170b0 commit 761e51a

File tree

5 files changed

+50
-13
lines changed

5 files changed

+50
-13
lines changed

Compiler/InlineServiceDefinitionsPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe
8282
return true;
8383
}
8484

85-
if ($definition->isPublic() || $definition->isLazy()) {
85+
if ($definition->isDeprecated() || $definition->isPublic() || $definition->isLazy()) {
8686
return false;
8787
}
8888

Container.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@
2828
*
2929
* Parameter and service keys are case insensitive.
3030
*
31-
* A service id can contain lowercased letters, digits, underscores, and dots.
32-
* Underscores are used to separate words, and dots to group services
33-
* under namespaces:
34-
*
35-
* <ul>
36-
* <li>request</li>
37-
* <li>mysql_session_storage</li>
38-
* <li>symfony.mysql_session_storage</li>
39-
* </ul>
40-
*
4131
* A service can also be defined by creating a method named
4232
* getXXXService(), where XXX is the camelized version of the id:
4333
*

Tests/ContainerBuilderTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,27 @@ public function testRegisterForAutoconfiguration()
10821082
// when called multiple times, the same instance is returned
10831083
$this->assertSame($childDefA, $container->registerForAutoconfiguration('AInterface'));
10841084
}
1085+
1086+
/**
1087+
* This test checks the trigger of a deprecation note and should not be removed in major releases.
1088+
*
1089+
* @group legacy
1090+
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
1091+
*/
1092+
public function testPrivateServiceTriggersDeprecation()
1093+
{
1094+
$container = new ContainerBuilder();
1095+
$container->register('foo', 'stdClass')
1096+
->setPublic(false)
1097+
->setDeprecated(true);
1098+
$container->register('bar', 'stdClass')
1099+
->setPublic(true)
1100+
->setProperty('foo', new Reference('foo'));
1101+
1102+
$container->compile();
1103+
1104+
$container->get('bar');
1105+
}
10851106
}
10861107

10871108
class FooClass

Tests/ContainerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ public function testGetLegacyServiceIds()
165165
public function testSet()
166166
{
167167
$sc = new Container();
168-
$sc->set('foo', $foo = new \stdClass());
169-
$this->assertSame($foo, $sc->get('foo'), '->set() sets a service');
168+
$sc->set('._. \\o/', $foo = new \stdClass());
169+
$this->assertSame($foo, $sc->get('._. \\o/'), '->set() sets a service');
170170
}
171171

172172
public function testSetWithNullResetTheService()

Tests/Dumper/PhpDumperTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,4 +598,30 @@ public function testDumpHandlesLiteralClassWithRootNamespace()
598598

599599
$this->assertInstanceOf('stdClass', $container->get('foo'));
600600
}
601+
602+
/**
603+
* This test checks the trigger of a deprecation note and should not be removed in major releases.
604+
*
605+
* @group legacy
606+
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
607+
*/
608+
public function testPrivateServiceTriggersDeprecation()
609+
{
610+
$container = new ContainerBuilder();
611+
$container->register('foo', 'stdClass')
612+
->setPublic(false)
613+
->setDeprecated(true);
614+
$container->register('bar', 'stdClass')
615+
->setPublic(true)
616+
->setProperty('foo', new Reference('foo'));
617+
618+
$container->compile();
619+
620+
$dumper = new PhpDumper($container);
621+
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation')));
622+
623+
$container = new \Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation();
624+
625+
$container->get('bar');
626+
}
601627
}

0 commit comments

Comments
 (0)