我有一个使用原生会话在Kohana 3.0中编写的应用程序。在不到1%的用户中,会话数据在重定向时丢失。
发生这种情况时,用户无法使用计算机上的任何浏览器登录。但是,他们可以在另一台计算机上登录。它们似乎都在Windows操作系统上,但版本不同。
这是一个独立的应用程序,但现在它通过另一个网站为一部分用户启动(在新窗口中)。只有那些用户才遇到这个问题。
我无法重新创建问题,并且猜测它与用户的计算机有关。是否有任何类型的防病毒软件或任何与会话数据混淆的东西?
我的会话配置是:
'native' => array(
'name' => 'myappname',
'encrypted' => TRUE,
'lifetime' => 1209600,
),
我添加了大量调试日志记录,失去会话数据的用户在这里:
2013-02-04 20:09:16 --- DEBUG: EC ******* start login - IP = 67.255.224.46
2013-02-04 20:09:16 --- DEBUG: EC cgl/user - logged in = 1 - IP = 67.255.224.46
2013-02-04 20:09:16 --- DEBUG: EC cgl/user ------- before redirect - user = 5 - logged in = 1 - redirect = bookshelf - $_SESSION = id = 431a0b849f91a37d29b58a23bf130fe9 [ auth_user=>12874 ] - IP = 67.255.224.46
2013-02-04 20:09:16 --- DEBUG: bookshelf/before ~~~~~ NO USER = 0 - logged in = 0 - $_SESSION = id = d502f35a37c7af525c1bda5476c9daac [ ] - IP = 67.255.224.46
2013-02-04 20:09:17 --- ERROR: You must log in to see this page. $_SESSION = id = 66bf60812be3f6b5e3c1df42916e7f18 [ ], IP = 67.255.224.46
“重定向前”直接位于我的Request::instance()->redirect('bookshelf');
之前。“书架/之前”是我控制器之前的方法。
没有丢失会话数据的用户的日志如下所示:
2013-02-04 14:17:53 --- DEBUG: EC ******* start login - IP = 98.89.106.34
2013-02-04 14:17:53 --- DEBUG: EC cgl/user - logged in = 1 - IP = 98.89.106.34
2013-02-04 14:17:53 --- DEBUG: EC cgl/user ------- before redirect - user = 5 - logged in = 1 - redirect = bookshelf - $_SESSION = id = 227e70d49c796ce03dc9f52d8a7b571e [ auth_user=>13246 ] - IP = 98.89.106.34
2013-02-04 14:17:53 --- DEBUG: EC bookshelf/before - logged in = 1 - $_SESSION = id = 227e70d49c796ce03dc9f52d8a7b571e [ auth_user=>13246 last_active=>1360005473 ] - IP = 98.89.106.34
2013-02-04 14:17:53 --- DEBUG: EC bookshelf/index - logged in = 1 - $_SESSION = id = 227e70d49c796ce03dc9f52d8a7b571e [ auth_user=>13246 last_active=>1360005473 school_id=> ] - IP = 98.89.106.34
答案 0 :(得分:1)
我在Kohana 3.3的会话中遇到了同样的问题。我在config / session.php中更改 'encrypted' => FALSE
解决了这个问题。像这样......
'database' => array(
'name' => 'session_database', // Make sure the name is unique for each session type
'encrypted' => FALSE,
'lifetime' => 43200, // 43200 is 12hrs session time
'group' => 'default',
'table' => 'sessions',
'columns' => array(
'session_id' => 'session_id',
'last_active' => 'last_active',
'contents' => 'contents'
),