Merge pull request #5773 from cakephp/2.7-session

Session issue in 2.7
This commit is contained in:
Mark Story 2015-01-28 21:18:20 -05:00
commit 7866605c71
2 changed files with 16 additions and 5 deletions

View file

@ -374,7 +374,7 @@ class CakeSession {
*
* @param string|null $name The name of the session variable (or a path as sent to Set.extract)
* @return mixed The value of the session variable, null if session not available,
* session not started, or provided name not found in the session.
* session not started, or provided name not found in the session, false on failure.
*/
public static function read($name = null) {
if (empty($name) && $name !== null) {
@ -478,11 +478,14 @@ class CakeSession {
* @return void
*/
public static function clear($renew = true) {
$_SESSION = null;
if ($renew) {
self::$id = null;
self::renew();
if (!$renew) {
$_SESSION = array();
return;
}
$_SESSION = null;
self::$id = null;
self::renew();
}
/**

View file

@ -413,6 +413,14 @@ class CakeSessionTest extends CakeTestCase {
TestCakeSession::clear(false);
$this->assertFalse(TestCakeSession::check('Delete.me'));
$this->assertFalse(TestCakeSession::check('Delete'));
TestCakeSession::write('Some.string', 'value');
TestCakeSession::clear(false);
$this->assertNull(TestCakeSession::read('Some'));
TestCakeSession::write('Some.string.array', array('values'));
TestCakeSession::clear(false);
$this->assertFalse(TestCakeSession::read());
}
/**