8000 Merge branch '2.8' into 3.2 · symfony/symfony@d3ca508 · GitHub
[go: up one dir, main page]

Skip to content

Commit d3ca508

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 876f53d + f49cc11 commit d3ca508

File tree

10 files changed

+88
-23
lines changed

10 files changed

+88
-23
lines changed

src/Symfony/Bridge/Twig/Form/TwigRenderer.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@
2020
*/
2121
class TwigRenderer extends FormRenderer implements TwigRendererInterface
2222
{
23-
/**
24-
* @var TwigRendererEngineInterface
25-
*/
26-
private $engine;
27-
2823
public function __construct(TwigRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null)
2924
{
3025
parent::__construct($engine, $csrfTokenManager);
26+
}
3127

32-
$this->engine = $engine;
28+
/**
29+
* Returns the engine used by this renderer.
30+
*
31+
* @return TwigRendererEngineInterface The renderer engine
32+
*/
33+
public function getEngine()
34+
{
35+
return parent::getEngine();
3336
}
3437

3538
/**
3639
* {@inheritdoc}
3740
*/
3841
public function setEnvironment(Environment $environment)
3942
{
40-
$this->engine->setEnvironment($environment);
43+
$this->getEngine()->setEnvironment($environment);
4144
}
4245
}

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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
*

src/Symfony/Component/DependencyInjection/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

src/Symfony/Component/DependencyInjection/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()

src/Symfony/Component/DependencyInjection/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
}

src/Symfony/Component/HttpFoundation/RedirectResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function setTargetUrl($url)
8787
<html>
8888
<head>
8989
<meta charset="UTF-8" />
90-
<meta http-equiv="refresh" content="1;url=%1$s" />
90+
<meta http-equiv="refresh" content="0;url=%1$s" />
9191
9292
<title>Redirecting to %1$s</title>
9393
</head>

src/Symfony/Component/Security/Core/Tests/Validator/Constraints/UserPasswordValidatorTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,29 @@ public function testPasswordIsNotValid()
9090
->assertRaised();
9191
}
9292

93+
/**
94+
* @dataProvider emptyPasswordData
95+
*/
96+
public function testEmptyPasswordsAreNotValid($password)
97+
{
98+
$constraint = new UserPassword(array(
99+
'message' => 'myMessage',
100+
));
101+
102+
$this->validator->validate($password, $constraint);
103+
104+
$this->buildViolation('myMessage')
105+
->assertRaised();
106+
}
107+
108+
public function emptyPasswordData()
109+
{
110+
return array(
111+
array(null),
112+
array(''),
113+
);
114+
}
115+
93116
/**
94117
* @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException
95118
*/

src/Symfony/Component/Security/Core/User/UserProviderInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ interface UserProviderInterface
4848
public function loadUserByUsername($username);
4949

5050
/**
51-
* Refreshes the user for the account interface.
51+
* Refreshes the user.
5252
*
5353
* It is up to the implementation to decide if the user data should be
5454
* totally reloaded (e.g. from the database), or if the UserInterface
@@ -59,7 +59,7 @@ public function loadUserByUsername($username);
5959
*
6060
* @return UserInterface
6161
*
62-
* @throws UnsupportedUserException if the account is not supported
62+
* @throws UnsupportedUserException if the user is not supported
6363
*/
6464
public function refreshUser(UserInterface $user);
6565

src/Symfony/Component/Security/Core/Validator/Constraints/UserPasswordValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public function validate($password, Constraint $constraint)
4040
}
4141

4242
if (null === $password || '' === $password) {
43+
$this->context->addViolation($constraint->message);
44+
4345
return;
4446
}
4547

0 commit comments

Comments
 (0)
0