Allow Seession settings to be changed

eg set the auto write + others
or set/unset can be chagned for single sets
This commit is contained in:
Clemens Schwaighofer
2024-12-20 18:48:00 +09:00
parent 7248906da7
commit d1e65c702e

View File

@@ -365,9 +365,10 @@ class Session
* @param bool $flag
* @return void
*/
public function setAutoWriteClose(bool $flag): void
public function setAutoWriteClose(bool $flag): Session
{
$this->auto_write_close = $flag;
return $this;
}
/**
@@ -515,12 +516,13 @@ class Session
* @param mixed $value value to set (can be anything)
* @return void
*/
public function set(string $name, mixed $value): void
public function set(string $name, mixed $value): Session
{
$this->checkValidSessionEntryKey($name);
$this->restartSession();
$_SESSION[$name] = $value;
$this->closeSessionCall();
return $this;
}
/**
@@ -579,7 +581,7 @@ class Session
* @param string $name _SESSION key name to remove
* @return void
*/
public function unset(string $name): void
public function unset(string $name): Session
{
if (!isset($_SESSION[$name])) {
return;
@@ -587,6 +589,7 @@ class Session
$this->restartSession();
unset($_SESSION[$name]);
$this->closeSessionCall();
return $this;
}
/**