Reading a session variable in CI3 that was set by CI4 |
Hello- I am working on a large migration from CI3 to CI4. I have attempted to set the session $savePath and $cookieName to be the same in CI3 and CI4, so that I can read in CI3 a session variable that is set by CI4. My example is that I have a CI4 page which requires login. It sets a session variable 'destination' with the URL to redirect to after logging in, then redirects (using a route) to the CI3 login page. However, once there I am not able to retrieve that session variable. I'm not sure what I am missing.
I changed app\Config\Session.php to have: Code: public string $cookieName = 'ci_session'; Code: $config['sess_driver'] = 'database'; My code in CI4 (app\Controllers\Manage\Admin.php) Code: public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { There is a route from auth/login that redirects to CI3 (application\controllers\Users.php). My CI3 code there looks like: Code: if($this->session->userdata('destination')!=""){ The above code keeps redirecting me to site_url('manage'). What am I missing to set the session var in CI4 and read it in CI3? Any help is appreciated, let me know if you have more questions. Thank you! |
Welcome Guest, Not a member yet? Register Sign In |