Refactoring SessionComponent::write() to allow the first param to be an array.

Removing eval() from CakeSession::returnSessionVars() and CakeSession::readSessionVar() 

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4506 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-02-12 00:57:44 +00:00
parent 5b85b87dc3
commit 0db06d9fdb
3 changed files with 27 additions and 16 deletions

View file

@ -230,17 +230,16 @@ class CakeSession extends Object {
if (is_null($name)) {
return $this->returnSessionVars();
}
if ($this->checkSessionVar($name)) {
$var = $this->__sessionVarNames($name);
if (empty($var)) {
return false;
}
$result = eval("return " . $var . ";");
if (empty($name)) {
return false;
}
$result = Set::extract($_SESSION, $name);
if (!is_null($result)) {
return $result;
}
$this->__setError(2, "$name doesn't exist");
$return = null;
return $return;
return null;
}
/**
* Returns all session variables.
@ -250,8 +249,7 @@ class CakeSession extends Object {
*/
function returnSessionVars() {
if (!empty($_SESSION)) {
$result = eval("return \$_SESSION;");
return $result;
return $_SESSION;
}
$this->__setError(2, "No Session vars set");
return false;
@ -268,7 +266,7 @@ class CakeSession extends Object {
if (empty($var)) {
return false;
}
$expression = $var . " = \$value;";
$expression = 'return ' . $var . " = \$value;";
eval ($expression);
}
/**