Skip to content

Commit f7d29b4

Browse files
Merge branch '5.0'
* 5.0: [Routing] fix tests [DI] minor cleanup [Form] group constraints when calling the validator Remove wrong @group legacy annotations [DependencyInjection] Fix dumping multiple deprecated aliases allow button names to start with uppercase letter Allow PHP ^7.2.5 States that the HttpClient provides a Http Async implementation [Routing] Fix ContainerLoader and ObjectLoaderTest [HttpKernel] Make ErrorListener::onKernelException()'s dispatcher argument explicit [HttpKernel] Drop deprecated ExceptionListener Removed extra whitespace [Security] Fix best encoder not wired using migrate_from
2 parents d598fcd + 85009c8 commit f7d29b4

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

Encoder/EncoderFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ private function getEncoderConfigFromAlgorithm(array $config): array
114114
}
115115

116116
if ($fromEncoders = ($config['migrate_from'] ?? false)) {
117-
$encoderChain = [];
117+
unset($config['migrate_from']);
118+
$encoderChain = [$this->createEncoder($config, true)];
119+
118120
foreach ($fromEncoders as $name) {
119121
if ($encoder = $this->encoders[$name] ?? false) {
120122
$encoder = $encoder instanceof PasswordEncoderInterface ? $encoder : $this->createEncoder($encoder, true);

Tests/Authentication/Provider/DaoAuthenticationProviderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
class DaoAuthenticationProviderTest extends TestCase
2525
{
26-
/**
27-
* @group legacy
28-
*/
2926
public function testRetrieveUserWhenProviderDoesNotReturnAnUserInterface()
3027
{
3128
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');

Tests/Authentication/Provider/UserAuthenticationProviderTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public function testAuthenticateWhenUsernameIsNotFoundAndHideIsTrue()
6161
$provider->authenticate($this->getSupportedToken());
6262
}
6363

64-
/**
65-
* @group legacy
66-
*/
6764
public function testAuthenticateWhenProviderDoesNotReturnAnUserInterface()
6865
{
6966
$this->expectException('Symfony\Component\Security\Core\Exception\AuthenticationServiceException');

Tests/Encoder/EncoderFactoryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ public function testMigrateFrom()
143143

144144
$factory = new EncoderFactory([
145145
'digest_encoder' => $digest = new MessageDigestPasswordEncoder('sha256'),
146-
'pbdkf2' => $digest = new MessageDigestPasswordEncoder('sha256'),
147-
'bcrypt_encoder' => ['algorithm' => 'bcrypt'],
148-
SomeUser::class => ['algorithm' => 'sodium', 'migrate_from' => ['bcrypt_encoder', 'digest_encoder']],
146+
SomeUser::class => ['algorithm' => 'sodium', 'migrate_from' => ['bcrypt', 'digest_encoder']],
149147
]);
150148

151149
$encoder = $factory->getEncoder(SomeUser::class);
@@ -154,6 +152,7 @@ public function testMigrateFrom()
154152
$this->assertTrue($encoder->isPasswordValid((new SodiumPasswordEncoder())->encodePassword('foo', null), 'foo', null));
155153
$this->assertTrue($encoder->isPasswordValid((new NativePasswordEncoder(null, null, null, \PASSWORD_BCRYPT))->encodePassword('foo', null), 'foo', null));
156154
$this->assertTrue($encoder->isPasswordValid($digest->encodePassword('foo', null), 'foo', null));
155+
$this->assertStringStartsWith(SODIUM_CRYPTO_PWHASH_STRPREFIX, $encoder->encodePassword('foo', null));
157156
}
158157

159158
public function testDefaultMigratingEncoders()

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": "^7.2.9",
19+
"php": "^7.2.5",
2020
"symfony/event-dispatcher-contracts": "^1.1|^2",
2121
"symfony/service-contracts": "^1.1.6|^2"
2222
},

0 commit comments

Comments
 (0)