mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-15 11:23:47 +09:00
Updates to vendors etc
This commit is contained in:
@@ -31,27 +31,11 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
/**
|
||||
* @var SessionBagInterface[]
|
||||
*/
|
||||
protected $bags = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $started = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $closed = false;
|
||||
|
||||
/**
|
||||
* @var AbstractProxy|\SessionHandlerInterface
|
||||
*/
|
||||
protected $saveHandler;
|
||||
|
||||
/**
|
||||
* @var MetadataBag
|
||||
*/
|
||||
protected $metadataBag;
|
||||
protected array $bags = [];
|
||||
protected bool $started = false;
|
||||
protected bool $closed = false;
|
||||
protected AbstractProxy|\SessionHandlerInterface $saveHandler;
|
||||
protected MetadataBag $metadataBag;
|
||||
|
||||
/**
|
||||
* Depending on how you want the storage driver to behave you probably
|
||||
@@ -78,16 +62,16 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* gc_probability, "1"
|
||||
* lazy_write, "1"
|
||||
* name, "PHPSESSID"
|
||||
* referer_check, ""
|
||||
* referer_check, "" (deprecated since Symfony 7.2, to be removed in Symfony 8.0)
|
||||
* serialize_handler, "php"
|
||||
* use_strict_mode, "1"
|
||||
* use_cookies, "1"
|
||||
* use_only_cookies, "1"
|
||||
* use_trans_sid, "0"
|
||||
* sid_length, "32"
|
||||
* sid_bits_per_character, "5"
|
||||
* trans_sid_hosts, $_SERVER['HTTP_HOST']
|
||||
* trans_sid_tags, "a=href,area=href,frame=src,form="
|
||||
* use_only_cookies, "1" (deprecated since Symfony 7.2, to be removed in Symfony 8.0)
|
||||
* use_trans_sid, "0" (deprecated since Symfony 7.2, to be removed in Symfony 8.0)
|
||||
* sid_length, "32" (@deprecated since Symfony 7.2, to be removed in 8.0)
|
||||
* sid_bits_per_character, "5" (@deprecated since Symfony 7.2, to be removed in 8.0)
|
||||
* trans_sid_hosts, $_SERVER['HTTP_HOST'] (deprecated since Symfony 7.2, to be removed in Symfony 8.0)
|
||||
* trans_sid_tags, "a=href,area=href,frame=src,form=" (deprecated since Symfony 7.2, to be removed in Symfony 8.0)
|
||||
*/
|
||||
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface|null $handler = null, ?MetadataBag $metaBag = null)
|
||||
{
|
||||
@@ -129,7 +113,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
}
|
||||
|
||||
if (filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL) && headers_sent($file, $line)) {
|
||||
throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
|
||||
throw new \RuntimeException(\sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
|
||||
}
|
||||
|
||||
$sessionId = $_COOKIE[session_name()] ?? null;
|
||||
@@ -142,8 +126,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* See https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character.
|
||||
* Allowed values are integers such as:
|
||||
* - 4 for range `a-f0-9`
|
||||
* - 5 for range `a-v0-9`
|
||||
* - 6 for range `a-zA-Z0-9,-`
|
||||
* - 5 for range `a-v0-9` (@deprecated since Symfony 7.2, it will default to 4 and the option will be ignored in Symfony 8.0)
|
||||
* - 6 for range `a-zA-Z0-9,-` (@deprecated since Symfony 7.2, it will default to 4 and the option will be ignored in Symfony 8.0)
|
||||
*
|
||||
* ---------- Part 2
|
||||
*
|
||||
@@ -155,6 +139,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* - The length of Windows and Linux filenames is limited to 255 bytes. Then the max must not exceed 255.
|
||||
* - The session filename prefix is `sess_`, a 5 bytes string. Then the max must not exceed 255 - 5 = 250.
|
||||
*
|
||||
* This is @deprecated since Symfony 7.2, the sid length will default to 32 and the option will be ignored in Symfony 8.0.
|
||||
*
|
||||
* ---------- Conclusion
|
||||
*
|
||||
* The parts 1 and 2 prevent the warning below:
|
||||
@@ -183,10 +169,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
return $this->saveHandler->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setId(string $id)
|
||||
public function setId(string $id): void
|
||||
{
|
||||
$this->saveHandler->setId($id);
|
||||
}
|
||||
@@ -196,10 +179,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
return $this->saveHandler->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setName(string $name)
|
||||
public function setName(string $name): void
|
||||
{
|
||||
$this->saveHandler->setName($name);
|
||||
}
|
||||
@@ -228,10 +208,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
return session_regenerate_id($destroy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function save()
|
||||
public function save(): void
|
||||
{
|
||||
// Store a copy so we can restore the bags in case the session was not left empty
|
||||
$session = $_SESSION;
|
||||
@@ -249,7 +226,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
$previousHandler = set_error_handler(function ($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;
|
||||
$msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', $handler::class);
|
||||
$msg = \sprintf('session_write_close(): Failed to write session data with "%s" handler', $handler::class);
|
||||
}
|
||||
|
||||
return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false;
|
||||
@@ -270,10 +247,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
$this->started = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function clear()
|
||||
public function clear(): void
|
||||
{
|
||||
// clear out the bags
|
||||
foreach ($this->bags as $bag) {
|
||||
@@ -287,10 +261,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
$this->loadSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function registerBag(SessionBagInterface $bag)
|
||||
public function registerBag(SessionBagInterface $bag): void
|
||||
{
|
||||
if ($this->started) {
|
||||
throw new \LogicException('Cannot register a bag when the session is already started.');
|
||||
@@ -302,7 +273,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
public function getBag(string $name): SessionBagInterface
|
||||
{
|
||||
if (!isset($this->bags[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
throw new \InvalidArgumentException(\sprintf('The SessionBagInterface "%s" is not registered.', $name));
|
||||
}
|
||||
|
||||
if (!$this->started && $this->saveHandler->isActive()) {
|
||||
@@ -314,14 +285,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
return $this->bags[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function setMetadataBag(?MetadataBag $metaBag = null)
|
||||
public function setMetadataBag(?MetadataBag $metaBag): void
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
$this->metadataBag = $metaBag ?? new MetadataBag();
|
||||
}
|
||||
|
||||
@@ -347,10 +312,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* @param array $options Session ini directives [key => value]
|
||||
*
|
||||
* @see https://php.net/session.configuration
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
public function setOptions(array $options): void
|
||||
{
|
||||
if (headers_sent() || \PHP_SESSION_ACTIVE === session_status()) {
|
||||
return;
|
||||
@@ -367,6 +330,10 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
]);
|
||||
|
||||
foreach ($options as $key => $value) {
|
||||
if (\in_array($key, ['referer_check', 'use_only_cookies', 'use_trans_sid', 'trans_sid_hosts', 'trans_sid_tags', 'sid_length', 'sid_bits_per_character'], true)) {
|
||||
trigger_deprecation('symfony/http-foundation', '7.2', 'NativeSessionStorage\'s "%s" option is deprecated and will be ignored in Symfony 8.0.', $key);
|
||||
}
|
||||
|
||||
if (isset($validOptions[$key])) {
|
||||
if ('cookie_secure' === $key && 'auto' === $value) {
|
||||
continue;
|
||||
@@ -392,16 +359,10 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* @see https://php.net/sessionhandlerinterface
|
||||
* @see https://php.net/sessionhandler
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setSaveHandler(AbstractProxy|\SessionHandlerInterface|null $saveHandler = null)
|
||||
public function setSaveHandler(AbstractProxy|\SessionHandlerInterface|null $saveHandler): void
|
||||
{
|
||||
if (1 > \func_num_args()) {
|
||||
trigger_deprecation('symfony/http-foundation', '6.2', 'Calling "%s()" without any arguments is deprecated, pass null explicitly instead.', __METHOD__);
|
||||
}
|
||||
|
||||
// Wrap $saveHandler in proxy and prevent double wrapping of proxy
|
||||
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
|
||||
$saveHandler = new SessionHandlerProxy($saveHandler);
|
||||
@@ -426,10 +387,8 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
* are set to (either PHP's internal, or a custom save handler set with session_set_save_handler()).
|
||||
* PHP takes the return value from the read() handler, unserializes it
|
||||
* and populates $_SESSION with the result automatically.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function loadSession(?array &$session = null)
|
||||
protected function loadSession(?array &$session = null): void
|
||||
{
|
||||
if (null === $session) {
|
||||
$session = &$_SESSION;
|
||||
|
||||
Reference in New Issue
Block a user