NativeSession and databases: or, where is the mystery session_start()?! |
[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 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!
[eluser]kirilisa[/eluser]
Hah, I figured out the rogue session_start() is located in the csrf_helper helper which I was autoloading. I would still like to know however, if you guys think this is a practical way to use NativeSession & databases, or if you believe I will run into problems. I've never used PHP sessions in a DB before so I'm still getting the hang of how it goes. (Perhaps I should be doing my set_save_handler somewhere else? In a hook or something?) Thanks! |
Welcome Guest, Not a member yet? Register Sign In |