Skip to content
This repository
Browse code

Fix for Session Component to use CakeSession started() checks. Refs #332

.
  • Loading branch information...
commit 9f5949ab5273048c76bf411d7c0057ba217d6132 1 parent 9740029
Graham Weldon authored March 26, 2010
16  cake/libs/controller/components/session.php
@@ -44,13 +44,6 @@ class SessionComponent extends CakeSession {
44 44
  */
45 45
 	var $__active = true;
46 46
 /**
47  
- * Used to determine if Session has been started
48  
- *
49  
- * @var boolean
50  
- * @access private
51  
- */
52  
-	var $__started = false;
53  
-/**
54 47
  * Used to determine if request are from an Ajax request
55 48
  *
56 49
  * @var boolean
@@ -89,7 +82,7 @@ function initialize(&$controller) {
89 82
  * @access public
90 83
  */
91 84
 	function startup(&$controller) {
92  
-		if ($this->__started === false && $this->__active === true) {
  85
+		if ($this->started() === false && $this->__active === true) {
93 86
 			$this->__start();
94 87
 		}
95 88
 	}
@@ -299,15 +292,14 @@ function id($id = null) {
299 292
  * @access private
300 293
  */
301 294
 	function __start() {
302  
-		if ($this->__started === false) {
  295
+		if ($this->started() === false) {
303 296
 			if (!$this->id() && parent::start()) {
304  
-				$this->__started = true;
305 297
 				parent::_checkValid();
306 298
 			} else {
307  
-				$this->__started = parent::start();
  299
+				parent::start();
308 300
 			}
309 301
 		}
310  
-		return $this->__started;
  302
+		return $this->started();
311 303
 	}
312 304
 }
313 305
 
4  cake/tests/cases/libs/controller/components/session.test.php
@@ -108,13 +108,13 @@ function testSessionAutoStart() {
108 108
 		Configure::write('Session.start', false);
109 109
 		$Session =& new SessionComponent();
110 110
 		$this->assertFalse($Session->__active);
111  
-		$this->assertFalse($Session->__started);
  111
+		$this->assertFalse($Session->started());
112 112
 		$Session->startup(new SessionTestController());
113 113
 
114 114
 		Configure::write('Session.start', true);
115 115
 		$Session =& new SessionComponent();
116 116
 		$this->assertTrue($Session->__active);
117  
-		$this->assertFalse($Session->__started);
  117
+		$this->assertFalse($Session->started());
118 118
 		$Session->startup(new SessionTestController());
119 119
 		$this->assertTrue(isset($_SESSION));
120 120
 

0 notes on commit 9f5949a

Please sign in to comment.
Something went wrong with that request. Please try again.