Skip to content

Commit c1170b0

Browse files
committed
Merge branch '2.8' into 3.2
* 2.8: [Security] Fix wrong term in UserProviderInterface [HttpFoundation] Set meta refresh time to 0 in RedirectResponse content disable inlining deprecated services [Security] validate empty passwords again [DI] Remove irrelevant comment from container [TwigBridge] cleaner implementation of the TwigRenderer
2 parents 4c540dc + db8bdcf commit c1170b0

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
@@ -111,7 +111,7 @@ private function isInlineableDefinition($id, Definition $definition)
111111
return true;
112112
}
113113

114-
if ($definition->isPublic() || $definition->isLazy()) {
114+
if ($definition->isDeprecated() || $definition->isPublic() || $definition->isLazy()) {
115115
return false;
116116
}
117117

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
@@ -823,6 +823,27 @@ public function testAutowiring()
823823

824824
$this->assertEquals('a', (string) $container->getDefinition('b')->getArgument(0));
825825
}
826+
827+
/**
828+
* This test checks the trigger of a deprecation note and should not be removed in major releases.
829+
*
830+
* @group legacy
831+
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
832+
*/
833+
public function testPrivateServiceTriggersDeprecation()
834+
{
835+
$container = new ContainerBuilder();
836+
$container->register('foo', 'stdClass')
837+
->setPublic(false)
838+
->setDeprecated(true);
839+
$container->register('bar', 'stdClass')
840+
->setPublic(true)
841+
->setProperty('foo', new Reference('foo'));
842+
843+
$container->compile();
844+
845+
$container->get('bar');
846+
}
826847
}
827848

828849
class FooClass

Tests/ContainerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public function testGetLegacyServiceIds()
144144
public function testSet()
145145
{
146146
$sc = new Container();
147-
$sc->set('foo', $foo = new \stdClass());
148-
$this->assertSame($foo, $sc->get('foo'), '->set() sets a service');
147+
$sc->set('._. \\o/', $foo = new \stdClass());
148+
$this->assertSame($foo, $sc->get('._. \\o/'), '->set() sets a service');
149149
}
150150

151151
public function testSetWithNullResetTheService()

Tests/Dumper/PhpDumperTest.php

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

438438
$this->assertInstanceOf('stdClass', $container->get('foo'));
439439
}
440+
441+
/**
442+
* This test checks the trigger of a deprecation note and should not be removed in major releases.
443+
*
444+
* @group legacy
445+
* @expectedDeprecation The "foo" service is deprecated. You should stop using it, as it will soon be removed.
446+
*/
447+
public function testPrivateServiceTriggersDeprecation()
448+
{
449+
$container = new ContainerBuilder();
450+
$container->register('foo', 'stdClass')
451+
->setPublic(false)
452+
->setDeprecated(true);
453+
$container->register('bar', 'stdClass')
454+
->setPublic(true)
455+
->setProperty('foo', new Reference('foo'));
456+
457+
$container->compile();
458+
459+
$dumper = new PhpDumper($container);
460+
eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation')));
461+
462+
$container = new \Symfony_DI_PhpDumper_Test_Private_Service_Triggers_Deprecation();
463+
464+
$container->get('bar');
465+
}
440466
}

0 commit comments

Comments
 (0)