Just a thought - have you tried passing $hnd by reference? array(&$hnd, "open_session")
Otherwise when you try and set state in the class for it to be accessed elsewhere, it won't work because you've got (in this case) 6 distinct copies of the class used in handlers, and presumably a 7th (the original) that you're using in your code. Regards, Stephen Thorne. On Mon, 10 Feb 2003 06:42, michel 'ziobudda' morelli wrote: > Hi, I'm tryng new possibility to set a session handler via class: > > session_set_save_handler(array($hnd, "open_session"), > array($hnd, "close_session"), > array($hnd, "read_session"), > array($hnd, "write_session"), > array($hnd, "destroy_session"), > array($hnd, "gc_session") > > > Now, I'm using this read_session (into class): > > function read_session($sessionid) > { > $query = "select value,last from session where id = > '".session_id()."'"; > $this->dbms->Exec_Query($query); > //think the result like 'id|i:0;' > if ($this->dbms->ReturnNum() == 0) { > $session_exist = false; > } else { > zb_debug("session exist"); > $session_exist = true; > $session = $this->dbms->ReturnNextObject(); > zb_debug("value of session is ".$session->value); > > $expire = session_cache_expire(); > if ( ($session->last + $expire) < time() ) { > zb_debug("Session expire"); > zb_debug("delete from DB"); > $query = "delete from session where id = > '".session_id()."'"; > $this->dbms->Exec_Query($query); > zb_debug("session deleted"); > //La sessione è scaduta. > $this->session_exist = false; > } else { > session_decode($session->value); > var_dump($_SESSION); > > /** > this is the result: array(0) { } > ERROR!!!!! > */ > > } > > } > > return true; > } > > Why the session_decode give me an empty array ?? > > I'm tring > session_start() > session_set... > but the result is that my handler is ignored > > so I'm tring > session_set... > session_start() > but the result is an empty _SESSION array. > > Where is my error ? > > I have see the possibility to make a session-handler vie class into > tests directory so I have thinked that this is a php5 problem (or a my > problem with php5). > > Using cvs via > > cvs -z3 -d :pserver:[EMAIL PROTECTED]:/repository -z3 co php5 > > and with this configure: > > ./configure --with-apxs2=/usr/local/httpd-2.0.43/bin/apxs > --prefix=/usr/local/php5-`date +%d%m%G`/ - > -with-openssl --with-zlib --with-bz2 --with-gd --with-mysql > --with-xmlrpc > > Tnx in advance for all. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php