Skip to content

Commit e3b0272

Browse files
committed
Removing unused setting in Session configuration.
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
1 parent 3748987 commit e3b0272

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cake/libs/session.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,9 @@ function watch($var) {
349349
if (empty($var)) {
350350
return false;
351351
}
352-
$this->watchKeys[] = $var;
352+
if (!in_array($var, $this->watchKeys, true)) {
353+
$this->watchKeys[] = $var;
354+
}
353355
}
354356
/**
355357
* Tells Session to stop watching a given key path
@@ -571,10 +573,8 @@ function _checkValid() {
571573
$this->__setError(1, 'Session Highjacking Attempted !!!');
572574
}
573575
} else {
574-
srand ((double)microtime() * 1000000);
575576
$this->write('Config.userAgent', $this->_userAgent);
576577
$this->write('Config.time', $this->sessionTime);
577-
$this->write('Config.rand', mt_rand());
578578
$this->write('Config.timeout', 10);
579579
$this->valid = true;
580580
$this->__setError(1, 'Session is valid');

cake/tests/cases/libs/session.test.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,11 @@ function testReadAndWriteWithDatabaseStorage() {
369369
$this->Session->destroy();
370370
$this->assertFalse($this->Session->read('SessionTestCase'));
371371
session_write_close();
372+
373+
unset($_SESSION);
374+
ini_set('session.save_handler', 'files');
375+
Configure::write('Session.save', 'php');
376+
$this->setUp();
372377
}
373378
}
374379
?>

0 commit comments

Comments
 (0)