• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Session is on bad state after sess_destroy()

#1
[eluser]Unknown[/eluser]
After sess_destroy(), if you do a session->set_userdata the behavior is I think wrong:

Code:
function p1(){
        $this->output->enable_profiler(TRUE);
        $this->load->view('ok', array('msg'=>$this->session->userdata('msg')));
        $this->session->set_userdata('msg1',"oneone");
        $this->session->sess_destroy();
//        $this->session->sess_create();
        $this->session->set_userdata('msg',"one");
        $this->load->helper('url');
        $this->load->view('ok', array('msg'=> anchor('/test/p2','page 2')));
    }

    function p2(){
        $this->output->enable_profiler(TRUE);
        $this->load->view('ok', array('msg'=>$this->session->userdata('msg')));
        $this->load->view('ok', array('msg'=>$this->session->userdata('msg1')));
        $this->session->sess_destroy();
//        $this->session->sess_create();
        $this->session->set_userdata('msg',"two");
        $this->load->helper('url');
        $this->load->view('ok', array('msg'=>anchor('/test/p1','page 1')));
    }

Setting userdata after sess_destroy() provides inconsistent results
- empty session when $config['sess_use_database'] = True
- session containg both msg and msg1 when $config['sess_use_database'] = False


Uncommenting undocumented session->sess_create() after destroy produces consistent, (by me) expected results. Should fix bug #5904 and some other.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.