Skip to content

Commit ddc6171

Browse files
Merge branch '4.4' into 5.0
* 4.4: Fixed #35084 Add missing use statement [HttpClient] fix scheduling pending NativeResponse do not overwrite variable value [Profiler] wording Use spaces correctly to display options in DebugCommand X-Accel Nginx URL updated ticket-30197 [Validator] Add the missing translations for the Chinese (Taiwan) ("zh_TW") locale Fixed test added in #35022 Use locale_parse for computing fallback locales [Console] Fix filtering out identical alternatives when there is a command loader add note about HTTP status code change Migrate server:log command away from WebServerBundle [DependencyInjection][CheckTypeDeclarationsPass] Handle \Closure for callable [Security] Fix missing defaults for auto-migrating encoders bumped Symfony version to 4.4.3 updated VERSION for 4.4.2 updated CHANGELOG for 4.4.2
2 parents 4fa0454 + b9c5663 commit ddc6171

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Encoder/EncoderFactory.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ private function getEncoderConfigFromAlgorithm(array $config): array
144144
return [
145145
'class' => Pbkdf2PasswordEncoder::class,
146146
'arguments' => [
147-
$config['hash_algorithm'],
148-
$config['encode_as_base64'],
149-
$config['iterations'],
150-
$config['key_length'],
147+
$config['hash_algorithm'] ?? 'sha512',
148+
$config['encode_as_base64'] ?? true,
149+
$config['iterations'] ?? 1000,
150+
$config['key_length'] ?? 40,
151151
],
152152
];
153153

@@ -205,8 +205,8 @@ private function getEncoderConfigFromAlgorithm(array $config): array
205205
'class' => MessageDigestPasswordEncoder::class,
206206
'arguments' => [
207207
$config['algorithm'],
208-
$config['encode_as_base64'],
209-
$config['iterations'],
208+
$config['encode_as_base64'] ?? true,
209+
$config['iterations'] ?? 5000,
210210
],
211211
];
212212
}

Tests/Encoder/EncoderFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,11 @@ public function testDefaultMigratingEncoders()
162162
(new EncoderFactory([SomeUser::class => ['class' => NativePasswordEncoder::class, 'arguments' => []]]))->getEncoder(SomeUser::class)
163163
);
164164

165+
$this->assertInstanceOf(
166+
MigratingPasswordEncoder::class,
167+
(new EncoderFactory([SomeUser::class => ['algorithm' => 'bcrypt', 'cost' => 11]]))->getEncoder(SomeUser::class)
168+
);
169+
165170
if (!SodiumPasswordEncoder::isSupported()) {
166171
return;
167172
}

0 commit comments

Comments
 (0)