Skip to content

Commit

Permalink
Backporting changes related to session start checking done for 1.3 br…
Browse files Browse the repository at this point in the history
…anch in commit 7d51952 to 1.2 branch. Closes #1612
  • Loading branch information
ADmad committed Apr 5, 2011
1 parent b7e51d3 commit 561b8e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 3 additions & 10 deletions cake/libs/session.php
Expand Up @@ -116,13 +116,6 @@ class CakeSession extends Object {
* @access public
*/
var $id = null;
/**
* Session Started
*
* @var boolean
* @access protected
*/
var $_started = false;
/**
* Hostname
*
Expand Down Expand Up @@ -188,7 +181,7 @@ function start() {
session_write_close();
}
$this->__initSession();
$this->_started = $this->__startSession();
$this->__startSession();
return $this->started();
}
/**
Expand All @@ -198,7 +191,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;
Expand Down Expand Up @@ -792,6 +785,6 @@ function __gc($expires = null) {
$table = $db->fullTableName(Configure::read('Session.table'));
$db->execute("DELETE FROM " . $db->name($table) . " WHERE " . $db->name($table.'.expires') . " < ". $db->value(time()));
return true;
}
}
}
?>
4 changes: 4 additions & 0 deletions cake/tests/cases/libs/session.test.php
Expand Up @@ -148,6 +148,10 @@ function testStarted() {
unset($_SESSION);
$this->assertFalse($this->Session->started());
$this->assertTrue($this->Session->start());

$session = new CakeSession(null, false);
$this->assertTrue($session->started());
unset($session);
}
/**
* testError method
Expand Down

0 comments on commit 561b8e2

Please sign in to comment.