Index: library/Zend/Session/SessionManager.php =================================================================== --- library/Zend/Session/SessionManager.php (date 1312884853000) +++ library/Zend/Session/SessionManager.php (revision ) @@ -84,14 +84,16 @@ /** * Start session * - * if No sesion currently exists, attempt to start it. Calls - * {@link isValid()} once session_start() is called, and raises an + * if No sesion currently exists, attempt to start it. Calls + * {@link isValid()} once session_start() is called, and raises an * exception if validation fails. - * + * + * @param bool $preserveStorage If set to true, current session storage will not be overwritten by the + * contents of $_SESSION. * @return void * @throws Exception */ - public function start() + public function start($preserveStorage = false) { if ($this->sessionExists()) { return; @@ -107,7 +109,9 @@ if ($storage instanceof Storage\SessionStorage && $_SESSION !== $storage ) { + if(!$preserveStorage){ - $storage->fromArray($_SESSION); + $storage->fromArray($_SESSION); + } $_SESSION = $storage; } } @@ -257,9 +261,7 @@ session_regenerate_id(); return $this; } - $this->destroy(); session_regenerate_id(); - $this->start(); return $this; } @@ -384,19 +386,12 @@ return; } - if ($this->sessionExists()) { - $this->destroy(array('send_expire_cookie' => false)); + // Set new cookie TTL + $config->setCookieLifetime($ttl); - // Since a cookie was destroyed, we should regenerate the ID + if ($this->sessionExists()) { + // There is a running session so we'll regenerate id to send a new cookie $this->regenerateId(); } - - // Now simply set the cookie TTL - $config->setCookieLifetime($ttl); - - if (!$this->sessionExists()) { - // Restart session if necessary - $this->start(); - } - } + } +} -}