/**
* @return void
*/
public function save() { // Store a copy so we can restore the bags in case the session was not left empty
$session =
$_SESSION;
foreach ($this->bags
as $bag) { if (empty($_SESSION[$key =
$bag->
getStorageKey()])) { unset($_SESSION[$key]);
} } if ($_SESSION &&
[$key =
$this->metadataBag->
getStorageKey()] ===
array_keys($_SESSION)) { unset($_SESSION[$key]);
} // Register error handler to add information about the current save handler
$previousHandler =
set_error_handler(function D
$type,
$msg,
$file,
$line) use (&
$previousHandler) { if (\E_WARNING ===
$type &&
str_starts_with($msg, 'session_write_close():'
)) { $handler =
$this->saveHandler instanceof SessionHandlerProxy ?
$this->saveHandler->
getHandler() :
$this->saveHandler;