Fixing issue with Set::insert(), and changing CakeSession::_ _writeSessionVar() to use Set::insert()

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4510 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2007-02-12 20:06:39 +00:00
parent cdb8925912
commit 71115620bf
2 changed files with 8 additions and 10 deletions

View file

@ -263,12 +263,8 @@ class CakeSession extends Object {
* @return void * @return void
*/ */
function writeSessionVar($name, $value) { function writeSessionVar($name, $value) {
$var = $this->__sessionVarNames($name); $result = Set::insert($_SESSION, $name, $value);
if (empty($var)) { return (!empty($result));
return false;
}
$expression = 'return ' . $var . " = \$value;";
eval ($expression);
} }
/** /**
* Method called on close of a database * Method called on close of a database
@ -432,9 +428,9 @@ class CakeSession extends Object {
} }
} else { } else {
srand ((double)microtime() * 1000000); srand ((double)microtime() * 1000000);
$this->writeSessionVar('Config.rand', rand());
$this->writeSessionVar("Config.time", $this->sessionTime);
$this->writeSessionVar("Config.userAgent", $this->_userAgent); $this->writeSessionVar("Config.userAgent", $this->_userAgent);
$this->writeSessionVar("Config.time", $this->sessionTime);
$this->writeSessionVar('Config.rand', rand());
$this->valid = true; $this->valid = true;
$this->__setError(1, "Session is valid"); $this->__setError(1, "Session is valid");
} }

View file

@ -269,8 +269,10 @@ class Set extends Object {
} }
if ($i == count($path) - 1) { if ($i == count($path) - 1) {
$_list[$key] = $data; $_list[$key] = $data;
} elseif (!isset($_list[$key])) { } else {
if (!isset($_list[$key])) {
$_list[$key] = array(); $_list[$key] = array();
}
$_list =& $_list[$key]; $_list =& $_list[$key];
} }
} }