mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
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:
parent
d9113f5165
commit
f22dc77ea1
2 changed files with 33 additions and 32 deletions
|
@ -99,39 +99,40 @@ class CakeSession extends Object{
|
|||
*
|
||||
* @param string $base The base path for the Session
|
||||
*/
|
||||
function __construct($base = null) {
|
||||
$this->host = env('HTTP_HOST');
|
||||
function __construct($base = null, $start = true) {
|
||||
if($start === true) {
|
||||
$this->host = env('HTTP_HOST');
|
||||
|
||||
if (empty($base)) {
|
||||
$this->path = '/';
|
||||
} else {
|
||||
$this->path = $base;
|
||||
if (empty($base)) {
|
||||
$this->path = '/';
|
||||
} else {
|
||||
$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();
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -47,7 +47,7 @@ class SessionHelper extends AppHelper {
|
|||
*/
|
||||
function __construct($base = null) {
|
||||
if (!defined('AUTO_SESSION') || AUTO_SESSION == true) {
|
||||
$this->__Session =& new CakeSession($base);
|
||||
$this->__Session =& new CakeSession($base, false);
|
||||
} else {
|
||||
$this->__active = false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue