diff --git a/Command/UserPasswordEncoderCommand.php b/Command/UserPasswordEncoderCommand.php index 427ee1ed..efa9d0ed 100644 --- a/Command/UserPasswordEncoderCommand.php +++ b/Command/UserPasswordEncoderCommand.php @@ -134,7 +134,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($input->isInteractive() && !$emptySalt) { $emptySalt = true; - $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.'); + $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.'); if ($errorIo->confirm('Confirm salt generation ?')) { $salt = $this->generateSalt(); diff --git a/Debug/WrappedListener.php b/Debug/WrappedListener.php index ba002499..8404c73b 100644 --- a/Debug/WrappedListener.php +++ b/Debug/WrappedListener.php @@ -43,7 +43,7 @@ public function __invoke(RequestEvent $event) if (\is_callable($this->listener)) { ($this->listener)($event); } else { - @trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($this->listener), AbstractListener::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($this->listener), AbstractListener::class), \E_USER_DEPRECATED); $this->listener->handle($event); } $this->time = microtime(true) - $startTime; diff --git a/DependencyInjection/MainConfiguration.php b/DependencyInjection/MainConfiguration.php index 20c6c088..a01c97b8 100644 --- a/DependencyInjection/MainConfiguration.php +++ b/DependencyInjection/MainConfiguration.php @@ -228,7 +228,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto foreach ($v as $originalName => $cookieConfig) { if (false !== strpos($originalName, '-')) { $normalizedName = str_replace('-', '_', $originalName); - @trigger_error(sprintf('Normalization of cookie names is deprecated since Symfony 4.3. Starting from Symfony 5.0, the "%s" cookie configured in "logout.delete_cookies" will delete the "%s" cookie instead of the "%s" cookie.', $originalName, $originalName, $normalizedName), E_USER_DEPRECATED); + @trigger_error(sprintf('Normalization of cookie names is deprecated since Symfony 4.3. Starting from Symfony 5.0, the "%s" cookie configured in "logout.delete_cookies" will delete the "%s" cookie instead of the "%s" cookie.', $originalName, $originalName, $normalizedName), \E_USER_DEPRECATED); // normalize cookie names manually for BC reasons. Remove it in Symfony 5.0. $v[$normalizedName] = $cookieConfig; diff --git a/DependencyInjection/Security/Factory/FormLoginLdapFactory.php b/DependencyInjection/Security/Factory/FormLoginLdapFactory.php index a0cb0227..59ba5e45 100644 --- a/DependencyInjection/Security/Factory/FormLoginLdapFactory.php +++ b/DependencyInjection/Security/Factory/FormLoginLdapFactory.php @@ -40,7 +40,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config, if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', E_USER_DEPRECATED); + @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', \E_USER_DEPRECATED); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php b/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php index b14a4f67..8980c881 100644 --- a/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php +++ b/DependencyInjection/Security/Factory/HttpBasicLdapFactory.php @@ -44,7 +44,7 @@ public function create(ContainerBuilder $container, $id, $config, $userProvider, if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', E_USER_DEPRECATED); + @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', \E_USER_DEPRECATED); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php b/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php index 17c60e12..5b1be3db 100644 --- a/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php +++ b/DependencyInjection/Security/Factory/JsonLoginLdapFactory.php @@ -42,7 +42,7 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config, if (!empty($config['query_string'])) { if ('' === $config['search_dn'] || '' === $config['search_password']) { - @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', E_USER_DEPRECATED); + @trigger_error('Using the "query_string" config without using a "search_dn" and a "search_password" is deprecated since Symfony 4.4 and will throw an exception in Symfony 5.0.', \E_USER_DEPRECATED); } $definition->addMethodCall('setQueryString', [$config['query_string']]); } diff --git a/DependencyInjection/Security/Factory/SimpleFormFactory.php b/DependencyInjection/Security/Factory/SimpleFormFactory.php index 9ffd624a..4fa12827 100644 --- a/DependencyInjection/Security/Factory/SimpleFormFactory.php +++ b/DependencyInjection/Security/Factory/SimpleFormFactory.php @@ -30,7 +30,7 @@ public function __construct(bool $triggerDeprecation = true) $this->addOption('authenticator', null); if ($triggerDeprecation) { - @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), \E_USER_DEPRECATED); } } diff --git a/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php b/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php index 04c5ce16..01a8521c 100644 --- a/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php +++ b/DependencyInjection/Security/Factory/SimplePreAuthenticationFactory.php @@ -26,7 +26,7 @@ class SimplePreAuthenticationFactory implements SecurityFactoryInterface public function __construct(bool $triggerDeprecation = true) { if ($triggerDeprecation) { - @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use Guard instead.', __CLASS__), \E_USER_DEPRECATED); } } diff --git a/DependencyInjection/SecurityExtension.php b/DependencyInjection/SecurityExtension.php index 42114072..8260fb6c 100644 --- a/DependencyInjection/SecurityExtension.php +++ b/DependencyInjection/SecurityExtension.php @@ -545,7 +545,7 @@ private function createEncoder(array $config) // bcrypt encoder if ('bcrypt' === $config['algorithm']) { $config['algorithm'] = 'native'; - $config['native_algorithm'] = PASSWORD_BCRYPT; + $config['native_algorithm'] = \PASSWORD_BCRYPT; return $this->createEncoder($config); } @@ -556,7 +556,7 @@ private function createEncoder(array $config) $config['algorithm'] = 'sodium'; } elseif (\defined('PASSWORD_ARGON2I')) { $config['algorithm'] = 'native'; - $config['native_algorithm'] = PASSWORD_ARGON2I; + $config['native_algorithm'] = \PASSWORD_ARGON2I; } else { 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')); } @@ -569,7 +569,7 @@ private function createEncoder(array $config) $config['algorithm'] = 'sodium'; } elseif (\defined('PASSWORD_ARGON2ID')) { $config['algorithm'] = 'native'; - $config['native_algorithm'] = PASSWORD_ARGON2ID; + $config['native_algorithm'] = \PASSWORD_ARGON2ID; } else { 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')); } @@ -793,7 +793,7 @@ private function isValidIp(string $cidr): bool $cidrParts = explode('/', $cidr); if (1 === \count($cidrParts)) { - return false !== filter_var($cidrParts[0], FILTER_VALIDATE_IP); + return false !== filter_var($cidrParts[0], \FILTER_VALIDATE_IP); } $ip = $cidrParts[0]; @@ -803,11 +803,11 @@ private function isValidIp(string $cidr): bool return false; } - if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV4)) { return $netmask <= 32; } - if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + if (filter_var($ip, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { return $netmask <= 128; } diff --git a/Security/FirewallContext.php b/Security/FirewallContext.php index 41a508fe..25cc078a 100644 --- a/Security/FirewallContext.php +++ b/Security/FirewallContext.php @@ -36,7 +36,7 @@ public function __construct(iterable $listeners, ExceptionListener $exceptionLis $this->exceptionListener = $exceptionListener; if ($logoutListener instanceof FirewallConfig) { $this->config = $logoutListener; - @trigger_error(sprintf('Passing an instance of %s as the 3rd argument to "%s()" is deprecated since Symfony 4.2. Pass a %s instance instead.', FirewallConfig::class, __METHOD__, LogoutListener::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing an instance of %s as the 3rd argument to "%s()" is deprecated since Symfony 4.2. Pass a %s instance instead.', FirewallConfig::class, __METHOD__, LogoutListener::class), \E_USER_DEPRECATED); } elseif (null === $logoutListener || $logoutListener instanceof LogoutListener) { $this->logoutListener = $logoutListener; $this->config = $config; diff --git a/Security/LazyFirewallContext.php b/Security/LazyFirewallContext.php index a45cc9c6..65144b77 100644 --- a/Security/LazyFirewallContext.php +++ b/Security/LazyFirewallContext.php @@ -47,7 +47,7 @@ public function __invoke(RequestEvent $event) foreach (parent::getListeners() as $listener) { if (!\is_callable($listener)) { - @trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($listener), AbstractListener::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Calling the "%s::handle()" method from the firewall is deprecated since Symfony 4.3, extend "%s" instead.', \get_class($listener), AbstractListener::class), \E_USER_DEPRECATED); $listeners[] = [$listener, 'handle']; $lazy = false; } elseif (!$lazy || !$listener instanceof AbstractListener) { diff --git a/SecurityUserValueResolver.php b/SecurityUserValueResolver.php index 25a9244f..939b2f2d 100644 --- a/SecurityUserValueResolver.php +++ b/SecurityUserValueResolver.php @@ -19,7 +19,7 @@ use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Http\Controller\UserValueResolver; -@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.1, use "%s" instead.', SecurityUserValueResolver::class, UserValueResolver::class), E_USER_DEPRECATED); +@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.1, use "%s" instead.', SecurityUserValueResolver::class, UserValueResolver::class), \E_USER_DEPRECATED); /** * Supports the argument type of {@see UserInterface}. diff --git a/Templating/Helper/LogoutUrlHelper.php b/Templating/Helper/LogoutUrlHelper.php index 30ef9c28..0e8e518f 100644 --- a/Templating/Helper/LogoutUrlHelper.php +++ b/Templating/Helper/LogoutUrlHelper.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Templating\Helper; -@trigger_error('The '.LogoutUrlHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED); +@trigger_error('The '.LogoutUrlHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED); use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator; use Symfony\Component\Templating\Helper\Helper; diff --git a/Templating/Helper/SecurityHelper.php b/Templating/Helper/SecurityHelper.php index f6738bd3..5a996d64 100644 --- a/Templating/Helper/SecurityHelper.php +++ b/Templating/Helper/SecurityHelper.php @@ -11,7 +11,7 @@ namespace Symfony\Bundle\SecurityBundle\Templating\Helper; -@trigger_error('The '.SecurityHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED); +@trigger_error('The '.SecurityHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED); use Symfony\Component\Security\Acl\Voter\FieldVote; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; diff --git a/Tests/DependencyInjection/CompleteConfigurationTest.php b/Tests/DependencyInjection/CompleteConfigurationTest.php index 3098f428..68920c86 100644 --- a/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -440,7 +440,7 @@ public function testEncodersWithArgon2i() ], 'JMS\FooBundle\Entity\User7' => [ 'class' => $sodium ? SodiumPasswordEncoder::class : NativePasswordEncoder::class, - 'arguments' => $sodium ? [256, 1] : [1, 262144, null, PASSWORD_ARGON2I], + 'arguments' => $sodium ? [256, 1] : [1, 262144, null, \PASSWORD_ARGON2I], ], ]], $container->getDefinition('security.encoder_factory.generic')->getArguments()); } @@ -555,7 +555,7 @@ public function testEncodersWithBCrypt() ], 'JMS\FooBundle\Entity\User7' => [ 'class' => NativePasswordEncoder::class, - 'arguments' => [null, null, 15, PASSWORD_BCRYPT], + 'arguments' => [null, null, 15, \PASSWORD_BCRYPT], ], ]], $container->getDefinition('security.encoder_factory.generic')->getArguments()); } diff --git a/Tests/Functional/UserPasswordEncoderCommandTest.php b/Tests/Functional/UserPasswordEncoderCommandTest.php index 40653dec..f4cb1c72 100644 --- a/Tests/Functional/UserPasswordEncoderCommandTest.php +++ b/Tests/Functional/UserPasswordEncoderCommandTest.php @@ -38,7 +38,7 @@ public function testEncodePasswordEmptySalt() 'user-class' => 'Symfony\Component\Security\Core\User\User', '--empty-salt' => true, ], ['decorated' => false]); - $expected = str_replace("\n", PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt')); + $expected = str_replace("\n", \PHP_EOL, file_get_contents(__DIR__.'/app/PasswordEncode/emptysalt.txt')); $this->assertEquals($expected, $this->passwordEncoderCommandTester->getDisplay()); } @@ -65,7 +65,7 @@ public function testEncodePasswordBcrypt() $output = $this->passwordEncoderCommandTester->getDisplay(); $this->assertStringContainsString('Password encoding succeeded', $output); - $encoder = new NativePasswordEncoder(null, null, 17, PASSWORD_BCRYPT); + $encoder = new NativePasswordEncoder(null, null, 17, \PASSWORD_BCRYPT); preg_match('# Encoded password\s{1,}([\w+\/$.]+={0,2})\s+#', $output, $matches); $hash = $matches[1]; $this->assertTrue($encoder->isPasswordValid($hash, 'password', null)); @@ -86,7 +86,7 @@ public function testEncodePasswordArgon2i() $output = $this->passwordEncoderCommandTester->getDisplay(); $this->assertStringContainsString('Password encoding succeeded', $output); - $encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2I); + $encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2I); preg_match('# Encoded password\s+(\$argon2i?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches); $hash = $matches[1]; $this->assertTrue($encoder->isPasswordValid($hash, 'password', null)); @@ -107,7 +107,7 @@ public function testEncodePasswordArgon2id() $output = $this->passwordEncoderCommandTester->getDisplay(); $this->assertStringContainsString('Password encoding succeeded', $output); - $encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, PASSWORD_ARGON2ID); + $encoder = $sodium ? new SodiumPasswordEncoder() : new NativePasswordEncoder(null, null, null, \PASSWORD_ARGON2ID); preg_match('# Encoded password\s+(\$argon2id?\$[\w,=\$+\/]+={0,2})\s+#', $output, $matches); $hash = $matches[1]; $this->assertTrue($encoder->isPasswordValid($hash, 'password', null)); @@ -314,7 +314,7 @@ public function testThrowsExceptionOnNoConfiguredEncoders() protected function setUp(): void { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode']); $kernel->boot(); @@ -332,7 +332,7 @@ protected function tearDown(): void private function setupArgon2i() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2i.yml']); $kernel->boot(); @@ -345,7 +345,7 @@ private function setupArgon2i() private function setupArgon2id() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'argon2id.yml']); $kernel->boot(); @@ -358,7 +358,7 @@ private function setupArgon2id() private function setupBcrypt() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'bcrypt.yml']); $kernel->boot(); @@ -371,7 +371,7 @@ private function setupBcrypt() private function setupSodium() { - putenv('COLUMNS='.(119 + \strlen(PHP_EOL))); + putenv('COLUMNS='.(119 + \strlen(\PHP_EOL))); $kernel = $this->createKernel(['test_case' => 'PasswordEncode', 'root_config' => 'sodium.yml']); $kernel->boot();