Permalink
Browse files

Backporting changes related to session start checking done for 1.3 br…

…anch in commit 7d51952 to 1.2 branch. Closes #1612
  • Loading branch information...
1 parent b7e51d3 commit 561b8e202cb8d064808a32cec2d89901915a6b3d @ADmad ADmad committed Apr 5, 2011
Showing with 7 additions and 10 deletions.
  1. +3 −10 cake/libs/session.php
  2. +4 −0 cake/tests/cases/libs/session.test.php
View
@@ -117,13 +117,6 @@ class CakeSession extends Object {
*/
var $id = null;
/**
- * Session Started
- *
- * @var boolean
- * @access protected
- */
- var $_started = false;
-/**
* Hostname
*
* @var string
@@ -188,7 +181,7 @@ function start() {
session_write_close();
}
$this->__initSession();
- $this->_started = $this->__startSession();
+ $this->__startSession();
return $this->started();
}
/**
@@ -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;
@@ -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;
- }
+ }
}
?>
@@ -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

0 comments on commit 561b8e2

Please sign in to comment.