Professional PHP5 Ch. 15 Custom Session Handler
To begin, sorry if I posted this in the wrong place, but this seemed like the best place to do it.
I implemented the usersession.phpm (class definition for UserSession) found in ch 15 of Professional PHP5, but instead utilizing the PearDB database abstraction layer (also with a few minor changes) recommended in Ch 8. The code is nearly verbatim except for a few changes to sql statements and some added exception throwing for missing parameters. I'm getting a fatal error that I have no clue how to track down and debug when running the usersessiontest.php included with the book's code. The output is identical until the end, where this is added:
Fatal error: Call to private method UserSession::_session_write_method() from context '' in Unknown on line 0
Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0
I'm running the app through Apache2 with PHP 5.0.3 installed. Everything seems to be peachy with the database handler abstraction class and the other classes I've tried. The class usersession.phpm is a custom session handler that reads and writes data and variables to a mysql database in my case.
// Remap PHP native session handling to use these class methods; found in the constructor for UserSession
session_set_save_handler(
array($this, '_session_open_method'),
array($this, '_session_close_method'),
array($this, '_session_read_method'),
array($this, '_session_write_method'),
array($this, '_session_destroy_method'),
array($this, '_session_gc_method')
);
// Overriding write method for UserSession class
private function _session_write_method($id, $sess_data) {
return TRUE;
}
Can anybody shed some light on how I might track this down? If there is more information required, let me know. Thanks for any help you can provide. Thank you ahead of time!
|