PHP 8.1: Use strict parameters in Session class

This commit is contained in:
Matias Griese
2021-12-02 15:05:29 +02:00
parent ae74f29b69
commit da3e32f945

View File

@@ -189,7 +189,12 @@ class Session implements SessionInterface
return $this;
}
$sessionName = session_name();
$sessionName = $this->getName();
$sessionId = $this->getId();
if (null === $sessionName || null === $sessionId) {
return $this;
}
$sessionExists = isset($_COOKIE[$sessionName]);
// Protection against invalid session cookie names throwing exception: http://php.net/manual/en/function.session-id.php#116836
@@ -341,7 +346,7 @@ class Session implements SessionInterface
$this->removeCookie();
setcookie(
session_name(),
$name,
'',
$this->getCookieOptions(-42000)
);
@@ -483,9 +488,15 @@ class Session implements SessionInterface
{
$this->removeCookie();
$sessionName = $this->getName();
$sessionId = $this->getId();
if (null === $sessionName || null === $sessionId) {
return;
}
setcookie(
session_name(),
session_id(),
$sessionName,
$sessionId,
$this->getCookieOptions()
);
}