From 62a5ac979e884e9ccee769dadbde1e3217e6e58f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 12 Mar 2021 10:36:06 +0100 Subject: [PATCH] Do not set a spiderID for legacy sessions of registered users This is the correct version of 0d262d1080533b952de104f45df7cf5a360d8892 which was reverted in 7476740c8a03adc20f2d5f0380b47556f61edd8a. During user change the guest legacy session is destroyed together with the actual guest session and a new session with a matching legacy session is created. At no point will a legacy session of a guest magically turn into a legacy session of a user and thus an `UPDATE` is never required. see #4067 --- .../files/lib/system/session/SessionHandler.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index ee482a1579..db3fb09f4e 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -723,7 +723,10 @@ final class SessionHandler extends SingletonFactory private function createLegacySession(): LegacySession { - $spiderID = $this->getSpiderID(UserUtil::getUserAgent()); + $spiderID = null; + if (!$this->user->userID) { + $spiderID = $this->getSpiderID(UserUtil::getUserAgent()); + } // save session $sessionData = [ -- 2.20.1