CodeIgniter Forums
Problem with session - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Problem with session (/showthread.php?tid=75940)



Problem with session - Iosef - 03-30-2020

Hello to everyone,

I really need some help here after upgrading both php and codeigniter to the last version Im getting all this warnings related to session:

Filename: Session/Session.php
Line Number: 282
Backtrace:
File: C:\xampp\htdocs\associationfx\application\core\MY_Controller.php
Line: 17
Function: __construct
File: C:\xampp\htdocs\associationfx\index.php
Line: 318
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: session_set_cookie_params(): Cannot change session cookie parameters when session is active
Filename: Session/Session.php
Line Number: 294
Backtrace:
File: C:\xampp\htdocs\associationfx\application\core\MY_Controller.php
Line: 17
Function: __construct
File: C:\xampp\htdocs\associationfx\index.php
Line: 318
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 304
Backtrace:
File: C:\xampp\htdocs\associationfx\application\core\MY_Controller.php
Line: 17
Function: __construct
File: C:\xampp\htdocs\associationfx\index.php
Line: 318
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: ini_set(): A session is active. You cannot change the session module's ini settings at this time
Filename: Session/Session.php
Line Number: 376
Backtrace:
File: C:\xampp\htdocs\associationfx\application\core\MY_Controller.php
Line: 17
Function: __construct
File: C:\xampp\htdocs\associationfx\index.php
Line: 318
Function: require_once

A PHP Error was encountered
Severity: Warning
Message: session_set_save_handler(): Cannot change save handler when session is active
Filename: Session/Session.php
Line Number: 110
Backtrace:
File: C:\xampp\htdocs\associationfx\application\core\MY_Controller.php
Line: 17
Function: __construct
File: C:\xampp\htdocs\associationfx\index.php
Line: 318
Function: require_once



Here is the problematic class:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Controller extends CI_Controller
{
   
public $data = array(

'title'=>'AssociationFx',


);

   
    function __construct()
    {
        parent::__construct();
       
      $this->load->helper('MY_helper');   

        if(isset($_SESSION['logged_in'])){
        $this->data['logged_in'] = $_SESSION['logged_in'];
        $this->data['firstname'] = $_SESSION['firstname'];
        $this->data['id']        = $_SESSION['id'];
        $this->data['permission']= $_SESSION['permission'];
        }
     

    }
}


RE: Problem with session - includebeer - 03-30-2020

What version of CI did you have before upgrading? And what version did you install? It looks like you are using 3.x, not 4.0.2.

And the problem seems to be that your MY_helper file is changing the session parameters while the session is already started.


RE: Problem with session - Iosef - 03-31-2020

(03-30-2020, 05:29 PM)includebeer Wrote: What version of CI did you have before upgrading? And what version did you install? It looks like you are using 3.x, not 4.0.2.

And the problem seems to be that your MY_helper file is changing the session parameters while the session is already started.


You are rigth, I was mistaking, Im running 3.1.10. I use to have 2.2.6 
As for the helper the problem dosent seams to come from there because if I comment out the line nothing change.
What else could be?



RE: Problem with session - InsiteFX - 03-31-2020

You need to replace the whole system folder, Sessions are now in a folder of there own.

you also need to replace the application config.php file it has a lot of changes.

Please make backup of these files just in case of an error.


RE: Problem with session - Iosef - 03-31-2020

(03-31-2020, 08:27 AM)InsiteFX Wrote: You need to replace the whole system folder, Sessions are now in a folder of there own.

you also need to replace the application config.php file it has a lot of changes.

Please make backup of these files just in case of an error.
Alrready done


RE: Problem with session - includebeer - 03-31-2020

(03-31-2020, 05:45 AM)Iosef Wrote:
(03-30-2020, 05:29 PM)includebeer Wrote: What version of CI did you have before upgrading? And what version did you install? It looks like you are using 3.x, not 4.0.2.

And the problem seems to be that your MY_helper file is changing the session parameters while the session is already started.


You are rigth, I was mistaking, Im running 3.1.10. I use to have 2.2.6 
As for the helper the problem dosent seams to come from there because if I comment out the line nothing change.
What else could be?

If you made some change and still have errors, copy those new errors here. And put that in a “code” block. It’s easier to read.