Skip to content

Commit 0972f90

Browse files
Merge branch '5.1'
* 5.1: Enable "native_constant_invocation" CS rule Make AbstractPhpFileCacheWarmer public Fix CS Add a warning comment on ldap empty password Bump Symfony version to 4.4.14 Update VERSION for 4.4.13 Update CHANGELOG for 4.4.13 [PhpunitBridge] Fix deprecation type detection
2 parents 3b68f38 + 0205ab8 commit 0972f90

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

Command/UserPasswordEncoderCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
134134
if ($input->isInteractive() && !$emptySalt) {
135135
$emptySalt = true;
136136

137-
$errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.');
137+
$errorIo->note('The command will take care of generating a salt for you. Be aware that some encoders advise to let them generate their own salt. If you\'re using one of those encoders, please answer \'no\' to the question below. '.\PHP_EOL.'Provide the \'empty-salt\' option in order to let the encoder handle the generation itself.');
138138

139139
if ($errorIo->confirm('Confirm salt generation ?')) {
140140
$salt = $this->generateSalt();

DependencyInjection/SecurityExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ private function createEncoder(array $config)
696696
// bcrypt encoder
697697
if ('bcrypt' === $config['algorithm']) {
698698
$config['algorithm'] = 'native';
699-
$config['native_algorithm'] = PASSWORD_BCRYPT;
699+
$config['native_algorithm'] = \PASSWORD_BCRYPT;
700700

701701
return $this->createEncoder($config);
702702
}
@@ -707,7 +707,7 @@ private function createEncoder(array $config)
707707
$config['algorithm'] = 'sodium';
708708
} elseif (\defined('PASSWORD_ARGON2I')) {
709709
$config['algorithm'] = 'native';
710-
$config['native_algorithm'] = PASSWORD_ARGON2I;
710+
$config['native_algorithm'] = \PASSWORD_ARGON2I;
711711
} else {
712712
throw new InvalidConfigurationException(sprintf('Algorithm "argon2i" is not available. Either use "%s" or upgrade to PHP 7.2+ instead.', \defined('SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13') ? 'argon2id", "auto' : 'auto'));
713713
}
@@ -720,7 +720,7 @@ private function createEncoder(array $config)
720720
$config['algorithm'] = 'sodium';
721721
} elseif (\defined('PASSWORD_ARGON2ID')) {
722722
$config['algorithm'] = 'native';
723-
$config['native_algorithm'] = PASSWORD_ARGON2ID;
723+
$config['native_algorithm'] = \PASSWORD_ARGON2ID;
724724
} else {
725725
throw new InvalidConfigurationException(sprintf('Algorithm "argon2id" is not available. Either use "%s", upgrade to PHP 7.3+ or use libsodium 1.0.15+ instead.', \defined('PASSWORD_ARGON2I') || $hasSodium ? 'argon2i", "auto' : 'auto'));
726726
}
@@ -944,7 +944,7 @@ private function isValidIp(string $cidr): bool
944944
$cidrParts = explode('/', $cidr);
945945

946946
if (1 === \count($cidrParts)) {
947-
return false !== filter_var($cidrParts[0], FILTER_VALIDATE_IP);
947+
return false !== filter_var($cidrParts[0], \FILTER_VALIDATE_IP);
948948
}
949949

950950
$ip = $cidrParts[0];
@@ -954,11 +954,11 @@ private function isValidIp(string $cidr): bool
954954
return false;
955955
}
956956

957-
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
957+
if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) {
958958
return $netmask <= 32;
959959
}
960960

961-
if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
961+
if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) {
962962
return $netmask <= 128;
963963
}
964964

Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ public function testEncodersWithArgon2i()
432432
],
433433
'JMS\FooBundle\Entity\User7' => [
434434
'class' => $sodium ? SodiumPasswordEncoder::class : NativePasswordEncoder::class,
435-
'arguments' => $sodium ? [256, 1] : [1, 262144, null, PASSWORD_ARGON2I],
435+
'arguments' => $sodium ? [256, 1] : [1, 262144, null, \PASSWORD_ARGON2I],
436436
],
437437
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
438438
}
@@ -542,7 +542,7 @@ public function testEncodersWithBCrypt()
542542
],
543543
'JMS\FooBundle\Entity\User7' => [
544544
'class' => NativePasswordEncoder::class,
545-
'arguments' => [null, null, 15, PASSWORD_BCRYPT],
545+
'arguments' => [null, null, 15, \PASSWORD_BCRYPT],
546546
],
547547
]], $container->getDefinition('security.encoder_factory.generic')->getArguments());
548548
}

Tests/Functional/UserPasswordEncoderCommandTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testEncodePasswordEmptySalt()
3838
'user-class' => 'Symfony\Component\Security\Core\User\User',
3939
'--empty-salt' => true,
4040
], ['decorated' => false]);
41-
$expected = str_replace("\n", PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt'));
41+
$expected = str_replace("\n", \PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt'));
4242

4343
$this->assertEquals($expected, $this->passwordEncoderCommandTester->getDisplay());
4444
}
@@ -65,7 +65,7 @@ public function testEncodePasswordBcrypt()
6565
$output = $this->passwordEncoderCommandTester->getDisplay();
6666
$this->assertStringContainsString('Password encoding succeeded', $output);
6767

68-
$encoder = new NativePasswordEncoder(null, null, 17, PASSWORD_BCRYPT);
68+
$encoder = new NativePasswordEncoder(null, null, 17, \PASSWORD_BCRYPT);
6969
preg_match('# Encoded password\s{1,}([\w+\/$.]+={0,2})\s+#', $output, $matches);
7070
$hash = $matches[1];
7171
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -86,7 +86,7 @@ public function testEncodePasswordArgon2i()
8686
$output = $this->passwordEncoderCommandTester->getDisplay();
8787
$this->assertStringContainsString('Password encoding succeeded', $output);
8888

89-
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2I);
89+
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2I);
9090
preg_match('# Encoded password\s+(\$argon2i?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches);
9191
$hash = $matches[1];
9292
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -107,7 +107,7 @@ public function testEncodePasswordArgon2id()
107107
$output = $this->passwordEncoderCommandTester->getDisplay();
108108
$this->assertStringContainsString('Password encoding succeeded', $output);
109109

110-
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2ID);
110+
$encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2ID);
111111
preg_match('# Encoded password\s+(\$argon2id?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches);
112112
$hash = $matches[1];
113113
$this->assertTrue($encoder->isPasswordValid($hash, 'password', null));
@@ -314,7 +314,7 @@ public function testThrowsExceptionOnNoConfiguredEncoders()
314314

315315
protected function setUp(): void
316316
{
317-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
317+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
318318
$kernel = $this->createKernel(['test_case' => 'PasswordEncode']);
319319
$kernel->boot();
320320

@@ -332,7 +332,7 @@ protected function tearDown(): void
332332

333333
private function setupArgon2i()
334334
{
335-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
335+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
336336
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml']);
337337
$kernel->boot();
338338

@@ -345,7 +345,7 @@ private function setupArgon2i()
345345

346346
private function setupArgon2id()
347347
{
348-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
348+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
349349
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2id.yml']);
350350
$kernel->boot();
351351

@@ -358,7 +358,7 @@ private function setupArgon2id()
358358

359359
private function setupBcrypt()
360360
{
361-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
361+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
362362
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'bcrypt.yml']);
363363
$kernel->boot();
364364

@@ -371,7 +371,7 @@ private function setupBcrypt()
371371

372372
private function setupSodium()
373373
{
374-
putenv('COLUMNS='.(119 + \strlen(PHP_EOL)));
374+
putenv('COLUMNS='.(119 + \strlen(\PHP_EOL)));
375375
$kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'sodium.yml']);
376376
$kernel->boot();
377377

0 commit comments

Comments
 (0)