Session issue with CI Environment set to Testing (CI4) |
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? |
Messages In This Thread |
Session issue with CI Environment set to Testing (CI4) - by shanilsoni - 10-27-2020, 06:59 AM
RE: Session issue with CI Environment set to Testing (CI4) - by includebeer - 10-27-2020, 02:56 PM
RE: Session issue with CI Environment set to Testing (CI4) - by dochis2013 - 02-07-2021, 11:32 AM
RE: Session issue with CI Environment set to Testing (CI4) - by kenjis - 02-07-2021, 03:52 PM
RE: Session issue with CI Environment set to Testing (CI4) - by dochis2013 - 02-07-2021, 09:35 PM
|