- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/session/session.php
- Класс: BitrixMainSessionSession
- Вызов: Session::save
public function save(): void
{
$session = $_SESSION;
$previousHandler = set_error_handler(
function($type, $msg, $file, $line) use (&$previousHandler) {
if ($type === E_WARNING && str_starts_with($msg, 'session_write_close():'))
{
$handler = $this->sessionHandler;
$msg = sprintf(
"session_write_close(): Failed to write session data with "%s" handler",
$handler? get_class($handler) : ''
);
}
return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false;
}
);
try
{
$this->refineReferencesBeforeSave();
session_write_close();
}
finally
{
restore_error_handler();
if ($_SESSION)
{
$_SESSION = $session;
}
}
$this->started = false;
}