Welcome Guest, Not a member yet? Register   Sign In
CI4 Sheild, cookie expiration change not working
#1

I'm using CI4 with Shield. I want the session to stay active indefinitely. In Config\Session.php I set the "expiration" and "timeToUpdate" properties to 60 * 60 * 24 * 365 (I also tried setting to 0). However, the cookie "ci_session" that gets created has an expiration of the same day still. How do I actually change that?

Action: Set Config\Session->expiration = 60 * 60 * 24 * 365

Expectation: I expected the ci_session cookie to be created with an expiration date of next year.

Result: ci_session cookie is created with same day expiration still.
Reply
#2

Cannot reproduce.
I get a cookie like this:
Code:
ci_session=11f0a0pefejn9bcs34ktlajce8dpjh07; expires=Tue, 26 Aug 2025 22:55:19 GMT; Max-Age=31536000; path=/; HttpOnly; SameSite=Lax



PHP Code:
--- a/app/Config/Session.php
+++ b/app/Config/Session.php
@@ -40,+40,@@ class Session extends BaseConfig
      
The number of SECONDS you want the session to last.
      Setting to 0 (zeromeans expire when the browser is closed.
      */
-
    public int $expiration 7200;
+
    public int $expiration 60 60 24 365;

    /**
      * -------------------------------------------------------------------------- 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB