session bugfix

This commit is contained in:
Stefan Dickmann 2014-08-26 17:47:45 +02:00
parent ff3273d8eb
commit 66ccfaf5e2
2 changed files with 7 additions and 1 deletions

View file

@ -267,7 +267,7 @@ class CakeSession {
* @return bool Success
*/
public static function delete($name) {
if (self::check($name)) {
if (self::start() && self::check($name)) {
self::_overwrite($_SESSION, Hash::remove($_SESSION, $name));
return !self::check($name);
}

View file

@ -365,6 +365,12 @@ class CakeSessionTest extends CakeTestCase {
* @return void
*/
public function testDelete() {
$this->assertTrue(TestCakeSession::write('Delete.me', 'Clearing out'));
session_write_close();
$this->assertTrue(TestCakeSession::delete('Delete.me'));
$this->assertFalse(TestCakeSession::check('Delete.me'));
$this->assertTrue(TestCakeSession::write('Delete.me', 'Clearing out'));
$this->assertTrue(TestCakeSession::delete('Delete.me'));
$this->assertFalse(TestCakeSession::check('Delete.me'));