From 91c25689d26e897c4de24ff9bee324cb07c69138 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 24 May 2018 17:52:07 +0200 Subject: [PATCH] simplified code --- .../Component/Security/Guard/GuardAuthenticatorHandler.php | 6 +----- .../Http/Firewall/AbstractPreAuthenticatedListener.php | 6 +----- .../Security/Http/Firewall/BasicAuthenticationListener.php | 6 +----- .../Security/Http/Firewall/DigestAuthenticationListener.php | 6 +----- .../Http/Firewall/SimplePreAuthenticationListener.php | 6 +----- .../Firewall/UsernamePasswordJsonAuthenticationListener.php | 5 +---- .../Security/Http/Session/SessionAuthenticationStrategy.php | 6 +----- 7 files changed, 7 insertions(+), 34 deletions(-) diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 3ff9cd51e1..1af407d236 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -136,10 +136,6 @@ class GuardAuthenticatorHandler if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php b/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php index 2054c4aa07..6286b6cf87 100644 --- a/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php @@ -123,10 +123,6 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php index 63bd013c64..0d32f9a3d2 100644 --- a/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/BasicAuthenticationListener.php @@ -98,10 +98,6 @@ class BasicAuthenticationListener implements ListenerInterface if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php index 88e9dc6312..bcdd0d168e 100644 --- a/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/DigestAuthenticationListener.php @@ -145,11 +145,7 @@ class DigestAuthenticationListener implements ListenerInterface if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php index cd70097d3a..7325658c8d 100644 --- a/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/SimplePreAuthenticationListener.php @@ -129,10 +129,6 @@ class SimplePreAuthenticationListener implements ListenerInterface if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php index 748ba07ad8..8bde1e0015 100644 --- a/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php +++ b/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordJsonAuthenticationListener.php @@ -190,9 +190,6 @@ class UsernamePasswordJsonAuthenticationListener implements ListenerInterface if (!$request->hasSession() || !$request->hasPreviousSession()) { return; } - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); } } diff --git a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php index 15e9b24bb9..9c1faa922c 100644 --- a/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php +++ b/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategy.php @@ -49,11 +49,7 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte case self::MIGRATE: // Note: this logic is duplicated in several authentication listeners // until Symfony 5.0 due to a security fix with BC compat - - // Destroying the old session is broken in php 5.4.0 - 5.4.10 - // See https://bugs.php.net/63379 - $destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411; - $request->getSession()->migrate($destroy); + $request->getSession()->migrate(true); return;