diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ec7e1e55b..f4d2f34d75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.7.39.2 +## 02/20/2023 + +1. [](#bugfix) + * Fix for invalid session breaking Flex Accounts (when switching from Regular to Flex) + # v1.7.39.1 ## 02/20/2023 diff --git a/system/defines.php b/system/defines.php index 2daf6ecebf..e26f1c9957 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.39.1'); +define('GRAV_VERSION', '1.7.39.2'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false); diff --git a/system/src/Grav/Framework/Session/Session.php b/system/src/Grav/Framework/Session/Session.php index 0dd9aedce4..5524d44222 100644 --- a/system/src/Grav/Framework/Session/Session.php +++ b/system/src/Grav/Framework/Session/Session.php @@ -11,6 +11,7 @@ use ArrayIterator; use Exception; +use Throwable; use Grav\Common\Debugger; use Grav\Common\Grav; use Grav\Common\User\Interfaces\UserInterface; @@ -254,13 +255,17 @@ public function start($readonly = false) $this->started = true; $this->onSessionStart(); - $user = $this->__get('user'); - if ($user && (!$user instanceof UserInterface || (method_exists($user, 'isValid') && !$user->isValid()))) { + try { + $user = $this->__get('user'); + if ($user && (!$user instanceof UserInterface || (method_exists($user, 'isValid') && !$user->isValid()))) { + throw new RuntimeException('Bad user'); + } + } catch (Throwable $e) { $this->invalidate(); - throw new SessionException('Invalid User object, session destroyed.', 500); } + // Extend the lifetime of the session. if ($sessionExists) { $this->setCookie();