Added fix for #1442.

SessionHelper was creating a second instance of CakeSession which would call the session_start(). Added a second param that can be set to false so this does not happen anymore

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3771 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-10-31 06:06:16 +00:00
parent d9113f5165
commit f22dc77ea1
2 changed files with 33 additions and 32 deletions

View file

@ -99,39 +99,40 @@ class CakeSession extends Object{
* *
* @param string $base The base path for the Session * @param string $base The base path for the Session
*/ */
function __construct($base = null) { function __construct($base = null, $start = true) {
$this->host = env('HTTP_HOST'); if($start === true) {
$this->host = env('HTTP_HOST');
if (empty($base)) { if (empty($base)) {
$this->path = '/'; $this->path = '/';
} else { } else {
$this->path = $base; $this->path = $base;
}
if (strpos($this->host, ':') !== false) {
$this->host = substr($this->host, 0, strpos($this->host, ':'));
}
if (env('HTTP_USER_AGENT') != null) {
$this->_userAgent = md5(env('HTTP_USER_AGENT') . CAKE_SESSION_STRING);
} else {
$this->_userAgent = "";
}
$this->time = time();
$this->sessionTime = $this->time + (Security::inactiveMins() * CAKE_SESSION_TIMEOUT);
$this->security = CAKE_SECURITY;
if (function_exists('session_write_close')) {
session_write_close();
}
$this->__initSession();
session_cache_limiter ("must-revalidate");
session_start();
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
$this->__checkValid();
} }
if (strpos($this->host, ':') !== false) {
$this->host = substr($this->host, 0, strpos($this->host, ':'));
}
if (env('HTTP_USER_AGENT') != null) {
$this->_userAgent = md5(env('HTTP_USER_AGENT') . CAKE_SESSION_STRING);
} else {
$this->_userAgent = "";
}
$this->time = time();
$this->sessionTime = $this->time + (Security::inactiveMins() * CAKE_SESSION_TIMEOUT);
$this->security = CAKE_SECURITY;
if (function_exists('session_write_close')) {
session_write_close();
}
$this->__initSession();
session_cache_limiter ("must-revalidate");
session_start();
header ('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
$this->__checkValid();
parent::__construct(); parent::__construct();
} }
/** /**

View file

@ -47,7 +47,7 @@ class SessionHelper extends AppHelper {
*/ */
function __construct($base = null) { function __construct($base = null) {
if (!defined('AUTO_SESSION') || AUTO_SESSION == true) { if (!defined('AUTO_SESSION') || AUTO_SESSION == true) {
$this->__Session =& new CakeSession($base); $this->__Session =& new CakeSession($base, false);
} else { } else {
$this->__active = false; $this->__active = false;
} }