Skip to content

Commit 83b737b

Browse files
[12.x] Ensure cookie lifetime matches session lifetime in StartSession middleware (#57266)
Updated getCookieExpirationDate() to use getSessionLifetimeInSeconds() instead of directly accessing the lifetime config, ensuring consistency between session and cookie expiration times.
1 parent 652cc51 commit 83b737b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Illuminate/Session/Middleware/StartSession.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ protected function getSessionLifetimeInSeconds()
262262
*/
263263
protected function getCookieExpirationDate()
264264
{
265-
$config = $this->manager->getSessionConfig();
265+
$expiresOnClose = $this->manager->getSessionConfig()['expire_on_close'];
266266

267-
return $config['expire_on_close'] ? 0 : Date::instance(
268-
Carbon::now()->addMinutes((int) $config['lifetime'])
267+
return $expiresOnClose ? 0 : Date::instance(
268+
Carbon::now()->addSeconds($this->getSessionLifetimeInSeconds())
269269
);
270270
}
271271

0 commit comments

Comments
 (0)