Skip to content

Commit

Permalink
Removing unused setting in Session configuration.
Browse files Browse the repository at this point in the history
Fixed bug in CakeSession::watch(); that allowed setting multiple vars to watch and CakeSession::ignore(); would only unset the first one found.
Fixed errors being thrown when testing database sessions and the database was dropped before script process ended.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8103 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
phpnut committed Mar 15, 2009
1 parent 3748987 commit e3b0272
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cake/libs/session.php
Expand Up @@ -349,7 +349,9 @@ function watch($var) {
if (empty($var)) {
return false;
}
$this->watchKeys[] = $var;
if (!in_array($var, $this->watchKeys, true)) {
$this->watchKeys[] = $var;
}
}
/**
* Tells Session to stop watching a given key path
Expand Down Expand Up @@ -571,10 +573,8 @@ function _checkValid() {
$this->__setError(1, 'Session Highjacking Attempted !!!');
}
} else {
srand ((double)microtime() * 1000000);
$this->write('Config.userAgent', $this->_userAgent);
$this->write('Config.time', $this->sessionTime);
$this->write('Config.rand', mt_rand());
$this->write('Config.timeout', 10);
$this->valid = true;
$this->__setError(1, 'Session is valid');
Expand Down
5 changes: 5 additions & 0 deletions cake/tests/cases/libs/session.test.php
Expand Up @@ -369,6 +369,11 @@ function testReadAndWriteWithDatabaseStorage() {
$this->Session->destroy();
$this->assertFalse($this->Session->read('SessionTestCase'));
session_write_close();

unset($_SESSION);
ini_set('session.save_handler', 'files');
Configure::write('Session.save', 'php');
$this->setUp();
}
}
?>

0 comments on commit e3b0272

Please sign in to comment.