mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #4405 from php-engineer/master-session-bugfix
CakeSession::delete() bugfix
This commit is contained in:
commit
5863adda42
2 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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'));
|
||||
|
|
Loading…
Reference in a new issue