1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-12 17:44:37 +02:00

e107::getSession()->set will now accept multi-dimensional key format. Test added. Form-handler PHP8 fix.

This commit is contained in:
Cameron
2021-02-08 11:59:04 -08:00
parent 608c0c57b1
commit 72c54371cc
4 changed files with 58 additions and 16 deletions

View File

@@ -303,13 +303,34 @@ class e_session
/**
* Set value in current session namespace
* Equals to $_SESSION[NAMESPACE][$key] = $value
* @param string $key
* @param string $key Also accepts multi-dimensinal format. key1/key2
* @param mixed $value
* @return e_session
*/
public function set($key, $value)
{
$this->_data[$key] = $value;
if(strpos($key,'/') !== false) // multi-dimensional
{
$keyArr = explode('/',$key);
$count = count($keyArr);
if($count === 2)
{
list($k1, $k2) = $keyArr;
$this->_data[$k1][$k2] = $value;
}
elseif($count === 3)
{
list($k1, $k2, $k3) = $keyArr;
$this->_data[$k1][$k2][$k3] = $value;
}
}
else
{
$this->_data[$key] = $value;
}
return $this;
}