From: Tim Düsterhus Date: Tue, 2 Dec 2014 01:23:00 +0000 (+0100) Subject: Properly resolve conflicting UNIQUE KEY in virtual sessions X-Git-Tag: 2.1.0_Beta_1~105^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=796d4f145b8e6b2bfc1acb86dcfefc3d98f92c9a;p=GitHub%2FWoltLab%2FWCF.git Properly resolve conflicting UNIQUE KEY in virtual sessions --- diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 37401761da..c58ea088dc 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -738,14 +738,12 @@ class SessionHandler extends SingletonFactory { // MySQL error 23000 = unique key // do not check against the message itself, some weird systems localize them if ($e->getCode() == 23000) { - // find existing session for this user - $session = call_user_func(array($this->sessionClassName, 'getSessionByUserID'), $user->userID); - - // update session + // delete guest session $sessionEditor = new $this->sessionEditorClassName($this->session); - $sessionEditor->update(array( - 'userID' => $user->userID - )); + $sessionEditor->delete(); + + // inherit existing session + $this->session = $session; } else { // not our business