Bug #16043 Updated: $_SESSION can't use in PHP 4.1.2

From: Date: Fri, 15 Mar 2002 12:09:46 +0000
Subject: Bug #16043 Updated: $_SESSION can't use in PHP 4.1.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-2570@lists.php.net to get a copy of this message
ID: 16043 Updated by: williedeath@disco.at Reported By: tokimeki@pchome.com.tw Status: Closed Bug Type: Session related Operating System: Windows XP PHP Version: 4.1.2 New Comment: Isn't this important enough to make a new binary release for those without MSVC or new users that probably will get very confused when sessionmanagement isn't working. Just an idea. I think that you will be loosing some new users otherwise. Previous Comments: ------------------------------------------------------------------------ [2002-03-14 21:15:08] yohgaki@php.net Oops, this is fixed in CVS and will be fixed in 4.2.0 also. ------------------------------------------------------------------------ [2002-03-14 18:58:34] reel_taz@users.sourceforge.net I can confirm this with w2ksp2 + apache 1.3.23 ------------------------------------------------------------------------ [2002-03-14 15:58:47] fseesink@usa.net Sample scripts to show symptoms. The following script shows that NO session data is stored when you use the new $_SESSION variables only as described in the PHP manual: __________________________________________________ <html><head><title>Simple PHP Session Test</title></head> <body> Testing PHP Sessions...<p> <?php error_reporting(E_ALL); session_start(); echo "Values at start of script:<br>"; foreach($_SESSION as $key => $value) { echo "\$_SESSION['$key'] => '$value'<br>"; } //Set/Increment Counter if ( !array_key_exists('counter', $_SESSION) ) { $_SESSION['counter'] = 0; } else { $_SESSION['counter']++; } echo "Values at end of script:<br>"; foreach($_SESSION as $key => $value) { echo "\$_SESSION['$key'] => '$value'<br>"; } ?> </body> </html> __________________________________________________ And the modified version of this script uses the older $HTTP_SESSION_VARS variable along with session_register(), to show that session_register() creates the initial instance of a session variable, but no updates occur after that. This is the best I've been able to do with sessions in 4.1.2, so it's pretty useless at this point. __________________________________________________ <html><head><title>Simple PHP Session Test</title></head> <body> Testing PHP Sessions...<p> <?php error_reporting(E_ALL); session_start(); echo "Values at start of script:<br>"; foreach($HTTP_SESSION_VARS as $key => $value) { echo "\$HTTP_SESSION_VARS['$key'] => '$value'<br>"; } //Set/Increment Counter if ( !array_key_exists('counter', $HTTP_SESSION_VARS) ) { $counter = 0; session_register('counter'); } else { $HTTP_SESSION_VARS['counter']++; } echo "Values at end of script:<br>"; foreach($HTTP_SESSION_VARS as $key => $value) { echo "\$HTTP_SESSION_VARS['$key'] => '$value'<br>"; } ?> </body> </html> __________________________________________________ P.S. For what it's worth, session files ARE created in the session.save_path directory, but other than the latter script, the files are always 0 bytes and completely empty. Hope this helps track down the bug. ------------------------------------------------------------------------ [2002-03-14 14:37:56] jbmurphyii@mac.com Also applies to NT 4.0 (sp6a) both Module and CGI $_SESSION and also $HTTP_SESSION_VARS are dead. From what I can tell the sess files get created in tmp ok, however nothing ever gets written to it. ------------------------------------------------------------------------ [2002-03-14 10:27:13] tokimeki@pchome.com.tw thank you for reply... I test the $_SESSION use those 3 PHP file... 1.php =============================== <?php session_start(); echo '<a href=2.php>TEST</a>'; echo '<hr>SESSION<br>'; foreach($_SESSION as $k => $v) echo "$k => $v<br>"; $_SESSION['a']='a'; ?> =============================== 2.php =============================== <?php session_start(); echo '<a href=3.php>TEST</a>'; echo '<hr>SESSION<br>'; foreach($_SESSION as $k => $v) echo "$k => $v<br>"; $_SESSION['b']='b'; ?> =============================== 3.php =============================== <?php session_start(); echo '<a href=1.php>TEST</a>'; echo '<hr>SESSION<br>'; foreach($_SESSION as $k => $v) echo "$k => $v<br>"; $_SESSION['c']='c'; ?> =============================== very simple... I like use PHP 4.1.x new features($_GET, $_POST, $_SESSION... etc), so I care about the $_SESSION can right work! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/16043 -- Edit this bug report at http://bugs.php.net/?id=16043&edit=1

« previous php.bugs (#2570) next »