From: Alexander Ebert Date: Wed, 31 Dec 2014 12:47:46 +0000 (+0100) Subject: Work-around for concurrent attempts to create a virtual session X-Git-Tag: 2.1.0_Beta_3~46^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dbb0aa36eded0b10988ae1369e1807434b96ac0a;p=GitHub%2FWoltLab%2FWCF.git Work-around for concurrent attempts to create a virtual session --- diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index c087d58bdd..aa3a292930 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -405,8 +405,18 @@ class SessionHandler extends SingletonFactory { $this->virtualSession = null; if ($this->user->userID && $this->supportsVirtualSessions) { $virtualSessionAction = new SessionVirtualAction(array(), 'create', array('data' => array('sessionID' => $this->session->sessionID))); - $returnValues = $virtualSessionAction->executeAction(); - $this->virtualSession = $returnValues['returnValues']; + + try { + $returnValues = $virtualSessionAction->executeAction(); + $this->virtualSession = $returnValues['returnValues']; + } + catch (DatabaseException $e) { + // MySQL error 23000 = unique key + // do not check against the message itself, some weird systems localize them + if ($e->getCode() == 23000) { + $this->virtualSession = SessionVirtual::getExistingSession($this->session->sessionID); + } + } } } }