sessions... unexpected behavior

From: Date: Thu, 14 Dec 2000 13:08:59 +0000
Subject: sessions... unexpected behavior
Groups: php.general 
Request: Send a blank email to php-general+get-30288@lists.php.net to get a copy of this message
I admit that although I am quite experienced PHP 4 user, sessions is a new ground for me. However, PHP 4 behavior exhibited in session handling functions isn't exactly what I'd expect... (tested with about two days old CVS snapshot) test.php source =============== 01 <? 02 error_reporting( E_ALL ) ; 03 session_name('testsession') ; 04 session_start() ; 05 $count = 0 ; 06 session_register( 'count' ) ; 07 $HTTP_SESSION_VARS['count']++ ; 08 echo session_is_registered('count') ? 'yes' : 'no' ; 09 echo $HTTP_SESSION_VARS['count'] ; 10 echo '<a href="/test2.php">test2.php</a>' ; 11 ?> test.php output =============== Warning: Undefined index: count in <snip>/test.php on line 7 yes 1 test2.php test2.php source ===============+ 01 <? 02 error_reporting( E_ALL ) ; 03 session_name('testsession') ; 04 session_start() ; 05 session_unregister( 'count' ) ; 06 $HTTP_SESSION_VARS['count']++ ; 07 echo session_is_registered('count') ? 'yes' : 'no' ; 08 echo $HTTP_SESSION_VARS['count'] ; 09 echo '<a href="/test3.php">test3.php</a>' ; 10 ?> test2.php output ================ no 2 test3.php test3.php source ===============+ 01 <? 02 error_reporting( E_ALL ) ; 03 session_name('testsession') ; 04 session_start() ; 05 $HTTP_SESSION_VARS['count']++ ; echo session_is_registered('count') ? 'yes' : 'no' ; echo '<a href="test.php">test.php</a>' ; test3.php output ================ yes 3 test.php Is this what it's supposed to do? ____________________________________________________________ Cynic: A member of a group of ancient Greek philosophers who taught that virtue constitutes happiness and that self control is the essential part of virtue. cynic@mail.cz

« previous php.general (#30288) next »