Welcome Guest, Not a member yet? Register   Sign In
CodeIgnite 2.2 released!
#1

[eluser]albertleao[/eluser]
Figured it deserved a thread!

I hope this doesn't delay the 3.0 release as they have to create an upgrade path.
#2

[eluser]satie[/eluser]
Hello, after CI 2.2.0 uploaded I have a problem with session.

This method doesn't work anymore (I have a class in libraries folder):


Code:
public function checkLogin()
        if ($this->CI->session->userdata('id_login') == TRUE) {

        } else {
            if (isset($site_url) && strlen($site_url) > 0) {
                redirect(base_url() . 'index.php/' . $site_url, 'refresh');
            }
        }
}

In my construct method I have:
Code:
public function __construct() {
        $this->CI =  get_instance();
    }

CheckLogin fails: $this->CI->session->userdata('id_login') is not set.


If I rollback previous version all works fine Sad

#3

[eluser]CroNiX[/eluser]
The upgrade instructions say you need the mcrypt extension installed. Do you?
#4

[eluser]CroNiX[/eluser]
Try deleting your cookies, clearing cache and clearing your session db table if using the db.
#5

[eluser]satie[/eluser]
Thanks CroNix.

Encrypt library loaded (in config/autoload.php)
mcrypt installed on my server
clean cache, cookie, etc.
Nothing. It seems that $this->session->userdata('username') doesn't persist if I switch to another Controller.

Controller 1: create a session ($this->session->set_userdata('username")
Controller 2: If I use $this->session->userdata('username'), it returns nothing.

Thanks again
#6

[eluser]CroNiX[/eluser]
Do you get anything if you
Code:
var_dump($this->session->all_userdata())
??
#7

[eluser]satie[/eluser]
Before redirect

Code:
array(9) { ["session_id"]=> string(32) "804e18657bb6c28251e83247ac5d45ad" ["ip_address"]=> string(12) "91.252.95.23" ["user_agent"]=> string(72) "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0" ["last_activity"]=> int(1402260042) ["user_data"]=> string(0) "" ["id_login"]=> string(1) "1" ["username"]=> string(5) "frank" ["livello"]=> string(1) "1" ["idadminsito"]=> string(1) "9" }

After redirect to another Controller:

Code:
array(5) { ["session_id"]=> string(32) "a52e55caebc7316dfed62838c8aac441" ["ip_address"]=> string(12) "91.252.95.23" ["user_agent"]=> string(72) "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0" ["last_activity"]=> int(1402260138) ["user_data"]=> string(0) "" }

Disappear "username", "livello", etc.
#8

[eluser]CroNiX[/eluser]
Strange. The session_id is different, so it's losing the data because it thinks it's a new session. I'm sorry, but I haven't tried the new version so I don't have anything more to suggest except to file an issue on github if one doesn't exist already.
#9

[eluser]Infinitum[/eluser]
Do you use db storage for session or cookies storage for it?
#10

[eluser]Infinitum[/eluser]
[quote author="satie" date="1402239002"]Hello, after CI 2.2.0 uploaded I have a problem with session.

This method doesn't work anymore (I have a class in libraries folder):


...

In my construct method I have:
Code:
public function __construct() {
        $this->CI =  get_instance();
    }

CheckLogin fails: $this->CI->session->userdata('id_login') is not set.

If I rollback previous version all works fine Sad

[/quote]


Maybe you forget &

Code:
public function __construct() {
        $this->CI =&  get_instance();
    }




Theme © iAndrew 2016 - Forum software by © MyBB