ID: 20520 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: Class/Object related Operating System: Linux PHP Version: 4.2.3 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Previous Comments: ------------------------------------------------------------------------ [2002-11-20 09:49:11] [EMAIL PROTECTED] The following script creates a class which should become a class for session-handling <?php class my_sess { var $const = 0; function my_sess () { echo 'Constructor'."\n"; echo (++$this->const)."<br>\n"; session_set_save_handler ( array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc') ); session_start (); } function open () { echo 'open'."\n"; echo (++$this->all)."<br>\n"; } function close () { echo 'close'."\n"; echo (++$this->all)."<br>\n"; } function read () { echo 'read'."\n"; echo (++$this->all)."<br>\n"; } function write () { echo 'write'."\n"; echo (++$this->all)."<br>\n"; } function destroy () { echo 'destroy'."\n"; echo (++$this->all)."<br>\n"; } function gc () { echo 'gc'."\n"; echo (++$this->all)."<br>\n"; } function set () { echo 'set'."\n"; echo (++$this->all)."<br>\n"; } } $session = new my_sess (); echo '------------'."<br>\n"; $session->set (); $session->set (); $session->set (); echo '------------'."<br>\n"; session_write_close (); ?> If you run this script you get the following output: --------------------------------------------------------- Constructor 1 Warning: Cannot send session cache limiter - headers already sent (output started at /data/here/htdocs/versuch2.php:6) in /data/here/htdocs/versuch2.php on line 16 open 1 read 2 ------------ set 3 set 4 set 5 ------------ write 3 close 4 ------------------------------------------------------- whereas you would expect -------------------------------------------------------- Constructor 1 Warning: Cannot send session cache limiter - headers already sent (output started at /data/here/htdocs/versuch2.php:6) in /data/here/htdocs/versuch2.php on line 16 open 1 read 2 ------------ set 3 set 4 set 5 ------------ write 6 close 7 -------------------------------------------------------- It seems like there are two instances of the class hanging around. But how they relate to each other is a mystery. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20520&edit=1