You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The system crashes if I try to login with the field Stay signed in (for up to 90 days)
This code is already very old and I'm curious if it ever worked?
The reason is an integer value as cookie parameter.
You find the following code in app\system\core\classes\RememberMeCore.php and as you can see the profileId, which is an Integer, is passed as cookie value.
public function enableSession(stdClass $oUserData): void
{
$aCookieData = [
// Hash one more time the password for the cookie
'member_remember' => Security::hashCookie($oUserData->password),
'member_id' => $oUserData->profileId
];
(new Cookie)->set($aCookieData, null, self::$iCookieDuration);
}
This results in a crash in the Cookie class function set, which is defined in framework\Cookie\Cookie.class.php.
public function set($mName, ?string $sValue = null, ?int $iTime = null, ?bool $bSecure = null): void
{
$iTime = time() + ((int)!empty($iTime) ? $iTime : Config::getInstance()->values['cookie']['expiration']);
$bSecure = !empty($bSecure) && is_bool($bSecure) ? $bSecure : Server::isHttps();
if (is_array($mName)) {
foreach ($mName as $sName => $sVal) {
$this->set($sName, $sVal, $iTime, $bSecure);
}
} else {
$sCookieName = Config::getInstance()->values['cookie']['prefix'] . $mName;
/* Check if we are not in localhost mode, otherwise may not work */
if (!Server::isLocalHost()) {
setcookie(
$sCookieName,
$sValue,
$iTime,
Config::getInstance()->values['cookie']['path'],
Config::getInstance()->values['cookie']['domain'],
$bSecure,
true
);
} else {
setcookie(
$sCookieName,
$sValue,
$iTime,
PH7_SH
);
}
}
}
I fixed the problem with the following conversion:
public function enableSession(stdClass $oUserData): void
{
$aCookieData = [
// Hash one more time the password for the cookie
'member_remember' => Security::hashCookie($oUserData->password),
'member_id' => (string) $oUserData->profileId
];
(new Cookie)->set($aCookieData, null, self::$iCookieDuration);
}
Maybe you prefer to fix the problem in the Cookie set function.
The text was updated successfully, but these errors were encountered:
The system crashes if I try to login with the field Stay signed in (for up to 90 days)
This code is already very old and I'm curious if it ever worked?
The reason is an integer value as cookie parameter.
You find the following code in app\system\core\classes\RememberMeCore.php and as you can see the profileId, which is an Integer, is passed as cookie value.
This results in a crash in the Cookie class function set, which is defined in framework\Cookie\Cookie.class.php.
I fixed the problem with the following conversion:
Maybe you prefer to fix the problem in the Cookie set function.
The text was updated successfully, but these errors were encountered: