Skip to content
Permalink
Browse files

Refs #332. Beginning fix for multiple session starts.

  • Loading branch information...
predominant committed Mar 25, 2010
1 parent 4f4d3f9 commit d95e482894927f8f9dbb80959d36a87d57467ed3
Showing with 27 additions and 15 deletions.
  1. +27 −15 cake/libs/session.php
@@ -116,6 +116,13 @@ class CakeSession extends Object {
* @access public
*/
var $id = null;
/**
* Session Started
*
* @var boolean
* @access public
*/
var $started = false;
/**
* Constructor.
*
@@ -163,16 +170,19 @@ function __construct($base = null, $start = true) {
/**
* Starts the Session.
*
* @param string $name Variable name to check for
* @return boolean True if variable is there
* @return boolean True if session was started
* @access public
*/
function start() {
if ($this->started) {
return true;
}
if (function_exists('session_write_close')) {
session_write_close();
}
$this->__initSession();
return $this->__startSession();
$this->started = $this->__startSession();
return $this->started;
}
/**
* Determine if Session has been started.
@@ -475,12 +485,13 @@ function __initSession() {
ini_set('session.auto_start', 0);
}
}
session_set_save_handler(array('CakeSession','__open'),
array('CakeSession', '__close'),
array('CakeSession', '__read'),
array('CakeSession', '__write'),
array('CakeSession', '__destroy'),
array('CakeSession', '__gc'));
session_set_save_handler(
array('CakeSession','__open'),
array('CakeSession', '__close'),
array('CakeSession', '__read'),
array('CakeSession', '__write'),
array('CakeSession', '__destroy'),
array('CakeSession', '__gc'));
break;
case 'php':
if (empty($_SESSION)) {
@@ -507,12 +518,13 @@ function __initSession() {
ini_set('session.cookie_path', $this->path);
}
}
session_set_save_handler(array('CakeSession','__open'),
array('CakeSession', '__close'),
array('Cache', 'read'),
array('Cache', 'write'),
array('Cache', 'delete'),
array('Cache', 'gc'));
session_set_save_handler(
array('CakeSession','__open'),
array('CakeSession', '__close'),
array('Cache', 'read'),
array('Cache', 'write'),
array('Cache', 'delete'),
array('Cache', 'gc'));
break;
default:
if (empty($_SESSION)) {

0 comments on commit d95e482

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.