diff --git a/cake/libs/session.php b/cake/libs/session.php index 2bd4ab0fd51..88b90da5273 100644 --- a/cake/libs/session.php +++ b/cake/libs/session.php @@ -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 @@ -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'); diff --git a/cake/tests/cases/libs/session.test.php b/cake/tests/cases/libs/session.test.php index 91d773cc76a..d3f9f5ec0a0 100644 --- a/cake/tests/cases/libs/session.test.php +++ b/cake/tests/cases/libs/session.test.php @@ -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(); } } ?> \ No newline at end of file