/** * @return bool */ protected static function backupForeignSession() { $sName = self::getOption("name"); if (session_id() && $sName != session_name()) { // there's a different session in use, stop it and restart the admin session self::$restoreSession = ["name" => session_name(), "id" => session_id()]; session_write_close(); session_id($_COOKIE[$sName]); return true; } return false; }
/** * @param string $namespace * @param bool $readOnly * @return \stdClass * @throws \Zend_Session_Exception */ public static function get($namespace = "pimcore_admin", $readOnly = false) { self::initSession(); if (!\Zend_Session::isStarted()) { \Zend_Session::start(); } if (!$readOnly) { // we don't force the session to start in read-only mode @session_start(); self::$sessionCookieCleanupNeeded = true; } if (!array_key_exists($namespace, self::$sessions) || !self::$sessions[$namespace] instanceof \Zend_Session_Namespace) { try { self::$sessions[$namespace] = new \Zend_Session_Namespace($namespace); } catch (\Exception $e) { // invalid session, regenerate the session, and return a dummy object \Zend_Session::regenerateId(); return new \stdClass(); } } self::$openedSessions++; return self::$sessions[$namespace]; }