New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flashdata bug #1756
Comments
Which version of CI are you using? |
Im using CI 2.1.2, but Im not sure, that I use driver-based session library. I think I use normal session library. The location of my session library file is ./system/libraries/Session.php. Please set $db['default']['cache_on'] = TRUE; and config['sess_use_database'] = TRUE; in your config and try it yourself. |
Yes, using database cache in combination with using session database is an issue Solution: // store current db_cache state and disable cache
$db_cache_state = $this->CI->db->cache_on;
$this->CI->db->cache_off();
$query = $this->CI->db->get($this->sess_table_name);
// restore db cache state if needed
if ($db_cache_state === TRUE) $this->CI->db->cache_on(); Maybe @philsturgeon or @alexbilbie or @pkriete from the dev team |
@dchill42 this should probably also go into the session driver from the 3.x develop tree |
Your solution did not work for me :/ But I fixed it with following code.
Sorry for my english. |
@GDmac that looks like a good fix. If caching is disabled during a query, the cache is bypassed and the query is actually run. I'm curious as to why it didn't seem to work for @mspiderv. That is the only place in the code where session data is read from the DB, and disabling caching around that query should prevent both reading from and writing to the cache for that lookup. In fact, that's a more efficient solution than selectively disabling cache writes for the session table, where the DB cache driver is still going to search for a (missing) match on every session load. Nonetheless, if the temporary cache disable was tried in the real world and failed, I'd like to know why. |
Ohh @GDmac was right. Sorry. Your fix works. It did not work for me, because I had some files cached and probably CI received data from them. After I deleted all cached files, session wokrs correctly. Thank you all. If you have the same problem, use this code.
|
I will put up a pull request with this fix for the Session driver. |
Signed-off-by: dchill42 <dchill42@gmail.com>
Applied this change in #1770. |
Signed-off-by: dchill42 <dchill42@gmail.com>
Session Fixes for bcit-ci#1711 and bcit-ci#1756
Set
$db['default']['cache_on'] = TRUE;
and...
$config['sess_use_database'] = TRUE;
Flashdata will not work correctly.
The text was updated successfully, but these errors were encountered: