/** * Starts a new session and stores it in the session if stateful * * @param common_session_Session $session * @return boolean */ public static function startSession(common_session_Session $session) { self::$session = $session; // do not start session in cli mode (testcase script) if (PHP_SAPI != 'cli') { if ($session instanceof common_session_StatefulSession) { // start session if not yet started if (session_id() === '') { session_name(GENERIS_SESSION_NAME); session_start(); } else { // prevent session fixation. session_regenerate_id(); } PHPSession::singleton()->setAttribute(self::PHPSESSION_SESSION_KEY, $session); } } return true; }