CodeIgniter Forums
Session class documentation does not explicitly state that Active Record must be activated - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Session class documentation does not explicitly state that Active Record must be activated (/showthread.php?tid=40654)



Session class documentation does not explicitly state that Active Record must be activated - El Forum - 04-15-2011

[eluser]seibelj[/eluser]
I pulled my hair out for 3 hours with this, thanks to user 'hammi' in #codeigniter IRC for helping me out.

I was trying to get the Session class to work with Postgres. No matter what settings I used, the first time you loaded a page a session would be created, then each page after would be blank. No warnings or errors displayed or in any log file (CI or Postgres or anything). If you cleared browser cookies, it would then reload once and display the page, add a new record to the DB, and then be blank for each page thereafter.

I went line by line in the Session class and discovered that it crashed here:

Code:
201. $this->CI->db->where('session_id', $session['session_id']);

YOU HAVE TO HAVE ACTIVE RECORD TURNED ON! I turned it off because I planned on writing straight SQL for speed, but it MUST be turned on!

Immediate Solution: Add "Active Record must be enabled" to the Session class documentation immediately, and possibly the Database configuration documentation as well.

Long Term Solution: Write code that accesses the DB in the session class without using active record if active record is turned off.


Session class documentation does not explicitly state that Active Record must be activated - El Forum - 04-15-2011

[eluser]Derek Allard[/eluser]
Sorry to hear this cost you time. If you wanted to help out, file a bug, or better yet, add that line into the userguide on bitbucket and make a pull request.