2
votes

I store sessions into a MySQL table using custom methods.

private static function load()
{
    session_module_name("user");
    session_set_save_handler(['\CB\Session', 'open'],
                             ['\CB\Session', 'close'],
                             ['\CB\Session', 'read'],
                             ['\CB\Session', 'write'],
                             ['\CB\Session', 'remove'],
                             ['\CB\Session', 'gc']
                             );
    session_start();       
}

Now I had to comment out session_module_name("user"); as it's removed in PHP 7.2. But now I get the error :

Warning: session_start(): Failed to read session data: user (path: /var/lib/php/sessions) in /home/username/path/lib/CB/Session.php on line 38

Why is it trying to read/write sessions at /var/lib/php/sessions when my functions are writing/reading them to a MySQL table. (And my MySQL table is not getting populated)

1

1 Answers

1
votes

Found the answer at http://php.net/manual/en/function.session-start.php#120589
My read function has to check session data for null and return '' if so.
I don't know if this is new thing in PHP or a bug.