Users lose CI session randomly and have to delete local cookie prior to logging in again |
[eluser]echadwickb[/eluser]
OK. I may have found and fixed the problem, though I need to do more testing to be sure. In sess_read(), CI checks the database for a matching session. If the query returns 0 rows, CI kills the session: Code: $query = $this->CI->db->get($this->sess_table_name); num_rows() calls db2_num_rows, which according to php.net, does not return a row count for select statements. Instead, it returns -1 regardless of the results found. $query->num_rows() never equals 0, which means the session is never destroyed, which means the user gets stuck in a endless loop until the local cookie is removed. As a solution, I extended the session class and overrode sess_read() to use the following logic instead: Code: if (count($query->result()) == 0) I think the bigger issue here is db2, specifically on i, does not play well with ActiveRecord. When I get a breather on my projects, I'd like to build and improve on the excellent db2c driver to tackle some of these "gotchas". DB2 on i has been a lot of fun to work with. I'd love to see more adoption in the CI community. Hope this helps someone else. |
Messages In This Thread |
Users lose CI session randomly and have to delete local cookie prior to logging in again - by El Forum - 01-26-2011, 05:49 PM
Users lose CI session randomly and have to delete local cookie prior to logging in again - by El Forum - 01-27-2011, 11:13 AM
Users lose CI session randomly and have to delete local cookie prior to logging in again - by El Forum - 01-28-2011, 08:14 AM
Users lose CI session randomly and have to delete local cookie prior to logging in again - by El Forum - 01-28-2011, 08:41 AM
Users lose CI session randomly and have to delete local cookie prior to logging in again - by El Forum - 01-28-2011, 08:48 AM
|