From c7cc780373fb2ceb2cb0cfc0ca21c36d44ff436b Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 14 Jun 2019 15:17:07 +0200 Subject: [PATCH 1/4] [FrameworkBundle] Unconditionally register the DateIntervalNormalizer --- .../DependencyInjection/FrameworkExtension.php | 5 ----- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ---- 2 files changed, 9 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 4688c192a0..1ce69472c2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -89,7 +89,6 @@ use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\CacheClassMetadataFactory; use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer; -use Symfony\Component\Serializer\Normalizer\DateIntervalNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Stopwatch\Stopwatch; @@ -1312,10 +1311,6 @@ class FrameworkExtension extends Extension { $loader->load('serializer.xml'); - if (!class_exists(DateIntervalNormalizer::class)) { - $container->removeDefinition('serializer.normalizer.dateinterval'); - } - if (!class_exists(ConstraintViolationListNormalizer::class)) { $container->removeDefinition('serializer.normalizer.constraint_violation_list'); } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 0b27dbff63..81f687c63f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -1102,10 +1102,6 @@ abstract class FrameworkExtensionTest extends TestCase public function testDateIntervalNormalizerRegistered() { - if (!class_exists(DateIntervalNormalizer::class)) { - $this->markTestSkipped('The DateIntervalNormalizer has been introduced in the Serializer Component version 3.4.'); - } - $container = $this->createContainerFromFile('full'); $definition = $container->getDefinition('serializer.normalizer.dateinterval'); From b3e32475579ca7aeabb8d17076eaf83f9eb773c9 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Fri, 28 Jun 2019 18:44:52 +0200 Subject: [PATCH 2/4] [FrameworkBundle] better message for disabled sessions --- .../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index a75402d6c1..68f0713b6d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -234,7 +234,7 @@ class FrameworkExtension extends Extension if ($this->isConfigEnabled($container, $config['session'])) { if (!\extension_loaded('session')) { - throw new \LogicException('PHP extension "session" is required.'); + throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://www.php.net/session.installation for instructions.'); } $this->sessionConfigEnabled = true; From 848e881d5d540d4b4a24a0e34f9f9bb77bffc977 Mon Sep 17 00:00:00 2001 From: Thomas Bisignani Date: Fri, 28 Jun 2019 14:56:51 +0200 Subject: [PATCH 3/4] [Security] [Guard] Removed useless param annotations --- .../Guard/AbstractGuardAuthenticator.php | 3 +-- .../AbstractFormLoginAuthenticator.php | 4 +--- .../Security/Guard/AuthenticatorInterface.php | 4 ---- .../Guard/GuardAuthenticatorHandler.php | 15 +++------------ .../Guard/GuardAuthenticatorInterface.php | 18 ++---------------- 5 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php index 8c09267d0f..7bcfc39438 100644 --- a/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/AbstractGuardAuthenticator.php @@ -36,8 +36,7 @@ abstract class AbstractGuardAuthenticator implements AuthenticatorInterface * Shortcut to create a PostAuthenticationGuardToken for you, if you don't really * care about which authenticated token you're using. * - * @param UserInterface $user - * @param string $providerKey + * @param string $providerKey * * @return PostAuthenticationGuardToken */ diff --git a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php index 7986b16b4c..a9c565b6bb 100644 --- a/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php +++ b/src/Symfony/Component/Security/Guard/Authenticator/AbstractFormLoginAuthenticator.php @@ -55,9 +55,7 @@ abstract class AbstractFormLoginAuthenticator extends AbstractGuardAuthenticator /** * Override to change what happens after successful authentication. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey + * @param string $providerKey * * @return RedirectResponse */ diff --git a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php index 90df7610ad..4912cb3bad 100644 --- a/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/AuthenticatorInterface.php @@ -30,8 +30,6 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface * * If this returns false, the authenticator will be skipped. * - * @param Request $request - * * @return bool */ public function supports(Request $request); @@ -53,8 +51,6 @@ interface AuthenticatorInterface extends GuardAuthenticatorInterface * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed Any non-null value * * @throws \UnexpectedValueException If null is returned diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 1cdcf6b967..24a16e3f0c 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -70,10 +70,7 @@ class GuardAuthenticatorHandler /** * Returns the "on success" response for the given GuardAuthenticator. * - * @param TokenInterface $token - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -93,10 +90,7 @@ class GuardAuthenticatorHandler * Convenience method for authenticating the user and returning the * Response *if any* for success. * - * @param UserInterface $user - * @param Request $request - * @param AuthenticatorInterface $authenticator - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ @@ -115,10 +109,7 @@ class GuardAuthenticatorHandler * Handles an authentication failure and returns the Response for the * GuardAuthenticator. * - * @param AuthenticationException $authenticationException - * @param Request $request - * @param AuthenticatorInterface $guardAuthenticator - * @param string $providerKey The key of the firewall + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php index 3a9828dfd6..7372eb844a 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php @@ -55,8 +55,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * return ['api_key' => $request->headers->get('X-API-TOKEN')]; * - * @param Request $request - * * @return mixed|null */ public function getCredentials(Request $request); @@ -69,9 +67,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * You may throw an AuthenticationException if you wish. If you return * null, then a UsernameNotFoundException is thrown for you. * - * @param mixed $credentials - * @param UserProviderInterface $userProvider - * * @throws AuthenticationException * * @return UserInterface|null @@ -87,9 +82,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * The *credentials* are the return value from getCredentials() * - * @param mixed $credentials - * @param UserInterface $user - * * @return bool * * @throws AuthenticationException @@ -105,8 +97,7 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * @see AbstractGuardAuthenticator * - * @param UserInterface $user - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return GuardTokenInterface */ @@ -121,9 +112,6 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * If you return null, the request will continue, but the user will * not be authenticated. This is probably not what you want to do. * - * @param Request $request - * @param AuthenticationException $exception - * * @return Response|null */ public function onAuthenticationFailure(Request $request, AuthenticationException $exception); @@ -137,9 +125,7 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * If you return null, the current request will continue, and the user * will be authenticated. This makes sense, for example, with an API. * - * @param Request $request - * @param TokenInterface $token - * @param string $providerKey The provider (i.e. firewall) key + * @param string $providerKey The provider (i.e. firewall) key * * @return Response|null */ From a03b5d8089f273ef778123bf4190dc888f422b89 Mon Sep 17 00:00:00 2001 From: Tobias Schultze Date: Mon, 1 Jul 2019 01:07:21 +0200 Subject: [PATCH 4/4] fix invalid call to PhpFileLoader::load() in a test --- .../Tests/DependencyInjection/Fixtures/php/merge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php index 3e1541a0e5..45ec00448f 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/Fixtures/php/merge.php @@ -1,6 +1,6 @@ load('merge_import.php', $container); +$this->load('merge_import.php'); $container->loadFromExtension('security', [ 'providers' => [