Skip to content

Commit

Permalink
session bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
steefaan committed Aug 26, 2014
1 parent ff3273d commit 66ccfaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/CakeSession.php
Expand Up @@ -267,7 +267,7 @@ public static function id($id = null) {
* @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);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/Cake/Test/Case/Model/Datasource/CakeSessionTest.php
Expand Up @@ -365,6 +365,12 @@ public function testStarted() {
* @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'));
Expand Down

0 comments on commit 66ccfaf

Please sign in to comment.