diff --git a/cake/libs/cake_session.php b/cake/libs/cake_session.php index a854db4d0..22ee0f50f 100644 --- a/cake/libs/cake_session.php +++ b/cake/libs/cake_session.php @@ -454,6 +454,9 @@ class CakeSession extends Object { * @access public */ function destroy() { + if ($this->started()) { + session_destroy(); + } $_SESSION = null; $this->__construct($this->path); $this->start(); diff --git a/cake/tests/cases/libs/cake_session.test.php b/cake/tests/cases/libs/cake_session.test.php index 2c4019d1e..1ef143f67 100644 --- a/cake/tests/cases/libs/cake_session.test.php +++ b/cake/tests/cases/libs/cake_session.test.php @@ -255,7 +255,8 @@ class CakeSessionTest extends CakeTestCase { $this->Session->destroy(); $this->assertFalse($this->Session->check('bulletProof')); $this->assertNotEqual($id, $this->Session->id()); - + $this->assertTrue($this->Session->started()); + $this->Session->cookieLifeTime = 'test'; $this->Session->destroy(); $this->assertNotEqual('test', $this->Session->cookieLifeTime);