codeigniter 3 - session not working with php 7.

codeigniter 3 - session not working with php 7.

codeigniter 3 - session not working with php 7."
I meet the same problem , then I check the code in Session.php and find that :

if (isset($_COOKIE[$this->_config['cookie_name']])
        && (
            !is_string($_COOKIE[$this->_config['cookie_name']])
            OR !preg_match('/^[0-9a-f]{40}$/', $_COOKIE[$this->_config['cookie_name']]))
){
    unset($_COOKIE[$this->_config['cookie_name']]);
} 

but the cookie is only 32 length ,so 'ci' create a new cookie everytime.

I change

  OR !preg_match('/^[0-9a-f]{40}$/', $_COOKIE[$this->_config['cookie_name']])

to

  OR !preg_match('/^[0-9a-f]{32}$/', $_COOKIE[$this->_config['cookie_name']])

then everything is ok !

Joyie - stackoverflow