Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removing protected var CakeSession::_started and instead session_id()…

… is now used to check if session is started in CakeSession::started(). This fixes issue where CakeSession::started() returned incorrect value when used across multiple objects. Closes #731
  • Loading branch information...
commit 7d51952801c14a88caa5ad7a1729e4de871e60ba 1 parent 06c1b58
@ADmad ADmad authored
View
14 cake/libs/cake_session.php
@@ -115,14 +115,6 @@ class CakeSession extends Object {
var $id = null;
/**
- * Session Started
- *
- * @var boolean
- * @access protected
- */
- var $_started = false;
-
-/**
* Hostname
*
* @var string
@@ -216,7 +208,7 @@ function start() {
session_write_close();
}
$this->__initSession();
- $this->_started = $this->__startSession();
+ $this->__startSession();
return $this->started();
}
@@ -227,7 +219,7 @@ function start() {
* @return boolean True if session has been started.
*/
function started() {
- if (isset($_SESSION) && $this->_started) {
+ if (isset($_SESSION) && session_id()) {
return true;
}
return false;
@@ -795,5 +787,5 @@ function __gc($expires = null) {
$return = $model->deleteAll(array($model->alias . ".expires <" => $expires), false, false);
return $return;
- }
+ }
}
View
4 cake/tests/cases/libs/cake_session.test.php
@@ -170,6 +170,10 @@ function testStarted() {
$_SESSION = null;
$this->assertFalse($this->Session->started());
$this->assertTrue($this->Session->start());
+
+ $session = new CakeSession(null, false);
+ $this->assertTrue($session->started());
+ unset($session);
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.