Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

Fix bug when exception thrown if invalid session id received #669

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions library/Zend/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,6 @@ public static function start($options = false)
{
// Check to see if we've been passed an invalid session ID
if ( self::getId() && !self::_checkId(self::getId()) ) {
// Generate a valid, temporary replacement
self::setId(md5(self::getId()));
// Force a regenerate after session is started
self::$_regenerateIdState = -1;
}
Expand All @@ -434,6 +432,11 @@ public static function start($options = false)
}

if (self::$_sessionStarted) {
// Generate valid session id
if (self::$_regenerateIdState === -1) {
self::regenerateId();
}

return; // already started
}

Expand Down Expand Up @@ -664,7 +667,7 @@ public static function setId($id)
if (!self::$_unitTestEnabled && defined('SID')) {
/** @see Zend_Session_Exception */
require_once 'Zend/Session/Exception.php';
throw new Zend_Session_Exception('The session has already been started. The session id must be set first.');
throw new Zend_Session_Exception('The session has already been started. The session id must be set first.');
}

if (!self::$_unitTestEnabled && headers_sent($filename, $linenum)) {
Expand Down