uawdijnntqw1x1x1
IP : 216.73.216.30
Hostname : xhost1.intravision.ru
Kernel : Linux xhost1.intravision.ru 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
tiskom
/
data
/
.
/
www
/
tiskom.xhost.intravision.ru
/
bitrix
/
modules
/
main
/
lib
/
session
/
session.php
/
/
<?php namespace Bitrix\Main\Session; use Bitrix\Main\Application; use Bitrix\Main\Config\Configuration; use Bitrix\Main\Session\Handlers\NullSessionHandler; use Bitrix\Main\Web\Cookie; class Session implements SessionInterface, \ArrayAccess { use ArrayAccessWithReferences; /** @var bool */ protected $started = false; /** @var \SessionHandlerInterface|null */ protected $sessionHandler; /** @var bool */ protected $lazyStartEnabled = false; /** @var bool */ protected $debug = false; /** @var Debugger */ protected $debugger; /** @var bool */ protected $ignoringSessionStartErrors = false; /** * Session constructor. */ public function __construct(\SessionHandlerInterface $sessionHandler = null) { $this->sessionHandler = $sessionHandler; $this->debugger = new Debugger(); session_register_shutdown(); if ($this->sessionHandler) { session_set_save_handler($this->sessionHandler, false); } } public function enableLazyStart(): self { $this->lazyStartEnabled = true; return $this; } public function disableLazyStart(): self { $this->lazyStartEnabled = false; return $this; } public function enableDebug(): self { $this->debug = true; return $this; } public function disableDebug(): self { $this->debug = false; return $this; } public function enableIgnoringSessionStartErrors(): self { $this->ignoringSessionStartErrors = true; return $this; } public function disableIgnoringSessionStartErrors(): self { $this->ignoringSessionStartErrors = false; return $this; } public function isActive(): bool { return session_status() === \PHP_SESSION_ACTIVE; } public function getId(): string { return session_id(); } public function setId($id) { if ($this->isActive()) { throw new \RuntimeException('Could not change the ID of an active session'); } session_id($id); } public function getName(): string { return session_name(); } public function setName($name) { if ($this->isActive()) { throw new \RuntimeException('Could not change the name of an active session'); } session_name($name); } public function start(): bool { if ($this->isStarted()) { return true; } if (session_status() === \PHP_SESSION_ACTIVE) { throw new \RuntimeException('Could not start session by PHP because session is active.'); } if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) { throw new \RuntimeException( "Could not start session because headers have already been sent. \"{$file}\":{$line}." ); } $this->debug('Session tries to start at'); $this->detectFirstUsage(); try { $this->applySessionStartIniSettings($this->getSessionStartOptions()); if (!session_start() && !$this->ignoringSessionStartErrors) { throw new \RuntimeException('Could not start session by PHP.'); } } catch (\Error $error) { Application::getInstance()->getExceptionHandler()->writeToLog($error); if ($error->getPrevious()) { Application::getInstance()->getExceptionHandler()->writeToLog($error->getPrevious()); } if (!$this->ignoringSessionStartErrors) { throw $error->getPrevious() ?: $error; } } $this->debug('Session started at'); $this->sessionData = &$_SESSION; $this->started = true; if ($this->has('destroyed')) { //todo 100? why? if ($this->get('destroyed') < time() - 100) { $this->clear(); } else { $newSessionId = $this->get('newSid'); $this->save(); $this->setId($newSessionId); return $this->start(); } } return true; } protected function getSessionStartOptions(): array { if ($this->sessionHandler instanceof NullSessionHandler) { return [ 'use_cookies' => 0, 'use_strict_mode' => 1, ]; } $options = [ 'cookie_httponly' => 1, 'use_strict_mode' => 1, ]; $domain = Cookie::getCookieDomain(); if ($domain) { $options['cookie_domain'] = $domain; } return $options; } protected function applySessionStartIniSettings(array $settings): void { foreach ($settings as $name => $value) { ini_set("session.{$name}", $value); } } public function regenerateId(): bool { if (!$this->isStarted()) { return false; } $newSessionId = session_create_id(); $this->set('newSid', $newSessionId); $this->set('destroyed', time()); $backup = $this->sessionData; $this->save(); $prevStrictMode = ini_set('session.use_strict_mode', 0); $this->setId($newSessionId); // Idea to switch on strict mode after setId is good. But in that case // session_start will invoke validateId for one time more. So behavior in // 7.1, 7.2 & 7.4 is different and now it's way to avoid that. // if ($prevStrictMode !== false) // { // ini_set('session.use_strict_mode', $prevStrictMode); // } $this->start(); $_SESSION = $backup; $this->remove('newSid'); $this->remove('destroyed'); return true; } public function destroy() { if ($this->isActive()) { session_destroy(); $this->started = false; } } public function save() { $session = $_SESSION; $previousHandler = set_error_handler( function($type, $msg, $file, $line) use (&$previousHandler) { if (E_WARNING === $type && 0 === strpos($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; } protected function processLazyStart() { if (!$this->lazyStartEnabled) { return false; } if ($this->isStarted()) { return false; } return $this->start(); } public function clear() { $_SESSION = []; $this->nullPointers = []; } public function isStarted() { return (bool)$this->started; } /** * @return Debugger */ public function getDebugger(): Debugger { return $this->debugger; } private function debug(string $text): void { if (!$this->debug) { return; } $this->getDebugger()->logToFile($text); } private function detectFirstUsage(): void { if (!$this->debug) { return; } $this->getDebugger()->detectFirstUsage(); } }
/var/www/tiskom/data/./www/tiskom.xhost.intravision.ru/bitrix/modules/main/lib/session/session.php