On Fri, Dec 12, 2008 at 7:30 PM, Jake McGraw <jmcgr...@gmail.com> wrote: > Update: > > Looks like the PECL serialize/unserialize used for storing the > $_SESSION array is different from PHP serialize/unserialize, so when > Zend app tries to read in the serialized data it doesn't understand > the serialized $_SESSION array. > > Anyone have experience with this?
I'm not aware of differences, cause I don't know about pecl/serialize? I thought those are in core. So I'm not sure what your comment relates to. But anyway, maybe this helps: <http://cvs.php.net/viewvc.cgi/pear/HTTP_Session2/HTTP/Session2/Container/Memcache.php?revision=1.6&view=markup> It's the memcache driver/container we use for HTTP_Session2. It implements the basics (read, write, close, open, etc.). Till > > - jake > > On Fri, Dec 12, 2008 at 12:31 PM, Jake McGraw <jmcgr...@gmail.com> wrote: >> I'm trying to create a custom Zend_Session save handler that works >> with memcache. The code basically goes like this: >> >> <?php >> >> class Custom_Session_SaveHandler_Memcached implements >> Zend_Session_SaveHandler_Interface { >> >> private $cache = null; >> >> public function __construct($cache) { >> $this->cache = $cache; >> } >> >> public function read ($id) { >> if(!($data = $this->cache->load($id))) { >> return ''; >> } else { >> return $data; >> } >> } >> >> public function write ($id, $data) { >> $this->cache->save($data, $id); >> return true; >> } >> >> public function open ($save_path, $name) { >> return true; >> } >> >> public function close () { >> return true; >> } >> >> public function destroy ($id) { >> } >> >> // not used for memcache >> public function gc ($maxlifetime) { >> return true; >> } >> } >> >> This works perfectly fine, session information is saved to memcache >> using the SID. The problem I'm having is that I have some legacy code >> which won't be utilizing Zend Framework and also uses memcache to save >> session information. I'd like to be able to share session information >> between the legacy code and my Zend App, but I've hit a wall because >> there appears to be a conflict between >> Zend_Session::setSaveHandler(memcache) and using the ini directive >> "session.save_handler=memcache". >> >> After debugging the issue, basically watching the state of my memcache >> values when transitioning from legacy code to my Zend app, it appears >> that the session information gets cleared between requests, so that >> any values written to memcache by the legacy app save handler won't >> transition into the Zend app and viceversa. >> >> Besides using ini settings in the Zend app, does anyone have any >> advice as to why this is happening? >> >> - jake >> >