Welcome Guest, Not a member yet? Register   Sign In
[split] Broken database sessions (CodeIgniter 3.1.3 Released)
#7

(This post was last modified: 01-10-2017, 11:32 PM by skunkbad.)

So, in regards to my problem with sessions and PHP 5.5, I can reproduce the problem. In the session database driver, the recent change adding the following code is the problem:


PHP Code:
if ($this->_lock === FALSE)
{
  return $this->_fail();
}
// Was the ID regenerated?
else 


To duplicate the problem, I can simply create a test controller and run it:



PHP Code:
<?php

class Test extends CI_Controller{
    
    public 
function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
 
       // This could be below the session regeneration, and still has a problem
        $this->load->helper('url');
        header"Location: " site_url'test/redirect_target' ), TRUE302 );

        $this->session->set_userdata'foo''bar' );

        $this->session->sess_regenerateTRUE );
    }

    public function redirect_target()
    {
        echo '<pre>';
        print_r$_SESSION );
        echo '</pre>';
    }



When the code in the session database driver is in place, "foo" is not shown in the session once redirected.

If the code in the session database driver is commented out, "foo" is shown in the session once redirected.

This is in a new install of CodeIgniter 3.1.3 on Ubuntu 14.04:

PHP Version 5.5.9-1ubuntu4.20

MariaDB version 10.1.20-MariaDB-1~trusty - mariadb.org binary distribution

Database client version: libmysql - mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $

There isn't anything special about this LAMP setup, it's just a basic webserver. You're probably not seeing a bunch of people reporting a problem because maybe the database driver is not popular? I can try other PHP 5.5 servers if necessary. PHP 7 works fine for some reason.

Edit --------

After more testing, it seems like the problem is using sess_regenerate with the parameter set to TRUE. I can even do this and instantly have an error with CI 3.1.3:


PHP Code:
<?php

class Test extends CI_Controller{
    
    public 
function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $this->session->set_userdata'foo''bar' );
        $this->session->sess_regenerateTRUE );

        echo '<pre>';
        print_r$_SESSION );
        echo '</pre>';
    }

Reply


Messages In This Thread
RE: CodeIgniter 3.1.3 Released - by skunkbad - 01-10-2017, 09:48 AM
RE: CodeIgniter 3.1.3 Released - by ivantcholakov - 01-10-2017, 10:14 AM
RE: CodeIgniter 3.1.3 Released - by skunkbad - 01-10-2017, 10:50 AM
RE: CodeIgniter 3.1.3 Released - by ivantcholakov - 01-10-2017, 11:28 AM
RE: CodeIgniter 3.1.3 Released - by skunkbad - 01-10-2017, 11:37 AM
RE: CodeIgniter 3.1.3 Released - by skunkbad - 01-10-2017, 08:51 PM
RE: CodeIgniter 3.1.3 Released - by ivantcholakov - 01-11-2017, 01:16 AM
RE: CodeIgniter 3.1.3 Released - by skunkbad - 01-11-2017, 01:26 AM
RE: CodeIgniter 3.1.3 Released - by xaiborweb - 12-12-2018, 04:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB