[eluser]laxkin[/eluser]
[quote author="Daniel H" date="1227242983"]Sorry to bump - has anybody experienced this problem before I raise a bug?[/quote]
Yes, I have same problem. I was planning to write a standalone post but found that one.
There is a BUG with DB caching and session flashdata.
The sequence(schematic) to reproduce this bug from my own project:
- uri: /admin/edit/articles
on this page request 'message' from session flashdata by session->flashdata('message')
as result executed sess_read() and this query is cached
An user can click the following url on the page: /admin/delete/article/<id>
- uri /admin/delete/article/<id>
sess->set_flashdata('message', 'bla-bla');
inside sess_write method executed there is a call of db->update (store 'message')
redirect to /admin/edit/articles (1st page)
- uri: /admin/edit/articles
sess_read() -> get
cached data without 'message'
WORKAROUND 1: extends CI_Session and wrap sess_read method as below
UPDATE: Create a new file MY_Session.php inside /aplication/library folder and copy/paste the following code:
Code:
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Session extends CI_Session
{
function MY_Session()
{
parent::CI_Session();
}
function sess_read()
{
// disable caching of session
$this->CI->db->cache_off();
$result = parent::sess_read();
$this->CI->db->cache_on();
return $result;
}
}
WORKAROUND 2: Turn off the DB cache
p.s. I hope this will help you to solve the problem.