Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:417 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70006 invoked from network); 28 Mar 2003 13:43:37 -0000 Received: from unknown (HELO laptop.ziobudda.net) (62.11.90.230) by pb1.pair.com with SMTP; 28 Mar 2003 13:43:37 -0000 Received: from loopback.enter.it (unknown [127.0.0.1]) by laptop.ziobudda.net (Postfix) with ESMTP id 36C7A8C512 for ; Fri, 28 Mar 2003 08:45:35 -0500 (EST) To: php-dev Content-Type: text/plain Organization: Message-ID: <1048859133.1446.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.1 Date: 28 Mar 2003 14:45:33 +0100 Content-Transfer-Encoding: 7bit Subject: Session into class does not works From: michel@ziobudda.net (michel 'ziobudda' morelli) Class for manage a session. It works with php 4.3.x but not with PHP5 (cvs every day). Note the read_session() function. bye "; } class zb_session { var $dbms; var $session_exist; var $session_close = false; function __construct() { zb_debug("Sono nel costruttore"); session_set_save_handler(array(&$this, "open_session"), array(&$this, "close_session"), array(&$this, "read_session"), array(&$this, "write_session"), array(&$this, "destroy_session"), array(&$this, "gc_session") ); session_start(); //$this->OpenConnect(); } function __destruct() { zb_debug("Sono nel distruttore"); if ($this->session_close === false) session_write_close(); //$this->dbms->DisconnectSQL(); } function zb_session() { $this->__construct(); } function open_session() { zb_debug("Dentro open_session()"); zb_debug("Sessione aperta"); return true; } function close_session() { $session_close = true; zb_debug("Dentro close_session"); zb_debug("Sessione chiusa"); return true; } function read_session($sessionid) { zb_debug("Dentro read_session"); zb_debug("This is the value of my session_encode(): id|i:0;"); session_decode('id|i:0;'); zb_debug("After session_decode: \$_SESSION:"); var_dump($_SESSION); zb_debug(" "); return true; } function write_session($sessionid,$sess) { zb_debug("session_encode = ".session_encode()); return true; } function destroy_session($sessionid) { zb_debug("Dentro destroy_session"); return true; } function gc_session() { zb_debug("Dentro gc_session"); return true; } } zb_debug("------INIZIALIZZO SESSIONE-----"); $hnd = & new zb_session; zb_debug("------ FINE INIZIALIZZO SESSIONE-----"); zb_debug("------SESSIONE START-----"); //session_start(); zb_debug("------FINE SESSIONE START-----"); zb_debug("------SETTO ID------"); $_SESSION['id']++; zb_debug("------FINE SETTO ID------"); echo "id = ".$_SESSION['id']."
"; echo "_SESSION = "; var_dump($_SESSION); zb_debug("
------Chiudo la sessione------"); session_write_close(); zb_debug("------FINE Chiudo la sessione------"); echo 'Clicca qui'; ob_end_flush(); ?> -- michel 'ziobudda' morelli