Welcome Guest, Not a member yet? Register   Sign In
Session issue with CI Environment set to Testing (CI4)
#1

I was having trouble setting up session data and retrieve them in other files. After a lot of trial and error, I found out that was because of the CI_ENVIRONMENT set to 'testing' in .env file. When this was set to either 'development' or 'production', this was working all fine.

Upon investigating the matter, this is the piece of code I found in Session.php file.

protected function startSession()
    {
        if (ENVIRONMENT === 'testing')
        {
            $_SESSION = [];
            return;
        }

        // @codeCoverageIgnoreStart
        session_start();
        // @codeCoverageIgnoreEnd
}


So essentially, for 'testing' environment, it is setting session to null and hence session data was not available. Can somebody let me know why session is set to null in here? What is the reason behind this?
Reply


Messages In This Thread
Session issue with CI Environment set to Testing (CI4) - by shanilsoni - 10-27-2020, 06:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB