Fixed set auth cookie issue (#1227)

This commit is contained in:
Roman Kelesidis 2023-12-20 08:37:16 +07:00 committed by GitHub
commit 7e7effefc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,19 +88,19 @@ function bb_setcookie(string $name, mixed $val, int $lifetime = COOKIE_PERSIST,
{
global $bb_cfg;
$cookie = new \Josantonius\Cookie\Cookie(
domain: $bb_cfg['cookie_domain'],
expires: $lifetime,
httpOnly: $httponly,
path: $bb_cfg['script_path'],
raw: $isRaw,
sameSite: $bb_cfg['cookie_same_site'],
secure: $bb_cfg['cookie_secure']
);
if (!empty($val)) {
$cookie = new \Josantonius\Cookie\Cookie(
domain: $bb_cfg['cookie_domain'],
expires: $lifetime,
httpOnly: $httponly,
path: $bb_cfg['script_path'],
raw: $isRaw,
sameSite: $bb_cfg['cookie_same_site'],
secure: $bb_cfg['cookie_secure']
);
$cookie->set($name, $val);
} else {
$cookie = new \Josantonius\Cookie\Cookie();
$cookie->remove($name);
}
}