403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/session/legacy/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/session/legacy/lazysessionstart.php
<?php

namespace Bitrix\Main\Session\Legacy;

use Bitrix\Main\Application;
use Bitrix\Main\InvalidOperationException;

final class LazySessionStart implements \ArrayAccess
{
	private static $instance;

	public static function register(): void
	{
		if (self::$instance)
		{
			throw new InvalidOperationException("LazySessionStart was already registered.");
		}

		// It's very important to make a reference to the LazySessionStart object,
		// because when somebody uses $_SESSION['d'] += $value;
		// it converts to: offsetGet & offsetSet. But PHP destroys
		// the object because it'll be the last reference and offsetSet crashes.
		$_SESSION = self::$instance = new self();
	}

	protected function start(): void
	{
		if ($this->isSessionAlreadyClosed() && !Application::getInstance()->getSession()->isAccessible())
		{
			$this->writeToLogError(
				new \RuntimeException(
					"Skipped cold session start because headers have already been sent. Be aware and fix usage of session, details in trace."
				)
			);

			$GLOBALS['_SESSION'] = [];

			return;
		}

		Application::getInstance()->getSession()->start();
	}

	public function offsetExists($offset): bool
	{
		$this->start();

		return isset($_SESSION[$offset]);
	}

	#[\ReturnTypeWillChange]
	public function &offsetGet($offset)
	{
		$this->start();

		return $_SESSION[$offset];
	}

	public function offsetSet($offset, $value): void
	{
		$this->start();

		$_SESSION[$offset] = $value;
	}

	public function offsetUnset($offset): void
	{
		$this->start();

		unset($_SESSION[$offset]);
	}

	private function isKernelWentSessionStart(): bool
	{
		return defined('BX_STARTED');
	}

	private function isSessionAlreadyClosed(): bool
	{
		return
			$this->isKernelWentSessionStart()
			&& !Application::getInstance()->getKernelSession()->isStarted()
		;
	}

	private function writeToLogError(\RuntimeException $exception): void
	{
		$exceptionHandler = Application::getInstance()->getExceptionHandler();
		$exceptionHandler->writeToLog($exception);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit