Welcome Guest, Not a member yet? Register   Sign In
NativeSession and databases: or, where is the mystery session_start()?!
#1

[eluser]kirilisa[/eluser]
Hi folks,

I was hoping someone with some experience using NativeSession would be able to give me some input.

First, while Native Session claims that you can use database storage with it http://codeigniter.com/wiki/Native_session/, I don't see that that is the case. There is nothing in the library that has anything to do with database storage. Thus, I was planning on adding a bit to it so that it would use a database based on whether or not sess_use_database in the config file was set to TRUE or not.

My grand plan was simply to stick something to the effect of

Code:
// Register this object as the session handler                                                                                                                          
session_set_save_handler(array(&$this, "_open"), array(&$this, "_close"), array(&$this, "_read"),
                         array(&$this, "_write"),array(&$this, "_destroy"),array(&$this, "_gc"));

into the constructor of the NativeSession library, and then add methods for _open, _close, _read, etc. as well.

Given that session_start isn't called until farther down in NativeSession (within the _sess_run() method and _regenerate_id() method) I figured I'd be all set.

But!

When I loaded up my page, I got the following warning/notice: Message: A session had already been started - ignoring session_start(). Thus of course my save handler won't work, since it has to be called before any session_start().

My question is, does anyone know where codeigniter is calling some other session_start()? I don't know how to find it. Moreover, is the way I was thinking of making NativeSession handle databases practical, or doomed to failure? Is there some other way I can force the application to get its session_save_handler set well before any session stuff comes into play?

Thanks!


Messages In This Thread
NativeSession and databases: or, where is the mystery session_start()?! - by El Forum - 03-18-2008, 12:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB