Skip to content

Commit

Permalink
Fix for Session Component to use CakeSession started() checks. Refs #332
Browse files Browse the repository at this point in the history
.
  • Loading branch information
predominant committed Mar 26, 2010
1 parent 13a55b6 commit 5d3f0d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions cake/libs/controller/components/session.php
Expand Up @@ -41,12 +41,12 @@ class SessionComponent extends CakeSession {
var $__active = true;

/**
* Used to determine if Session has been started
* Used to determine if request are from an Ajax request
*
* @var boolean
* @access private
*/
var $__started = false;
var $__bare = 0;

/**
* Class constructor
Expand All @@ -69,7 +69,7 @@ function __construct($base = null) {
* @access public
*/
function startup(&$controller) {
if ($this->__started === false && $this->__active === true) {
if ($this->started() === false && $this->__active === true) {
$this->__start();
}
}
Expand Down Expand Up @@ -275,15 +275,14 @@ function id($id = null) {
* @access private
*/
function __start() {
if ($this->__started === false) {
if ($this->started() === false) {
if (!$this->id() && parent::start()) {
$this->__started = true;
parent::_checkValid();
} else {
$this->__started = parent::start();
parent::start();
}
}
return $this->__started;
return $this->started();
}
}

Expand Down
4 changes: 2 additions & 2 deletions cake/tests/cases/libs/controller/components/session.test.php
Expand Up @@ -112,13 +112,13 @@ function testSessionAutoStart() {
Configure::write('Session.start', false);
$Session =& new SessionComponent();
$this->assertFalse($Session->__active);
$this->assertFalse($Session->__started);
$this->assertFalse($Session->started());
$Session->startup(new SessionTestController());

Configure::write('Session.start', true);
$Session =& new SessionComponent();
$this->assertTrue($Session->__active);
$this->assertFalse($Session->__started);
$this->assertFalse($Session->started());
$Session->startup(new SessionTestController());
$this->assertTrue(isset($_SESSION));

Expand Down

0 comments on commit 5d3f0d7

Please sign in to comment.