#16043 [Com]: $_SESSION can't use in PHP 4.1.2

From: Date: Sat, 19 Apr 2003 15:41:30 +0000
Subject: #16043 [Com]: $_SESSION can't use in PHP 4.1.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37900@lists.php.net to get a copy of this message
ID: 16043 Comment by: no at bulk-e-mail-marketing dot com Reported By: tokimeki at pchome dot com dot tw Status: Closed Bug Type: Session related Operating System: Windows XP PHP Version: 4.1.2 New Comment: WOW, I have been working on this problem for days, I am running php 4.0.6 on suse linux7.3 and had the same problem. This IS what fixxed me. // $HTTP_SESSION_VARS bugfix while(list($key , $value) = each($HTTP_SESSION_VARS)){ session_register($key); $$key = $value; } which was listed on this page by bluefoot project. THXS guys :-) Previous Comments: ------------------------------------------------------------------------ [2003-04-01 18:53:47] madstarr at bellsouth dot net Noticed that most of these emails related to the $_Session not maintaining the variable value occurred in 2002. Has this been resolved? I saw mentioned it was resolved with 4.2.0. I am running 4.2.2 on an NT 5.0 system, and experiencing the same problem trying to process form data from 3 forms. I combined the forms into 1, got rid of the $_SESSION and just used $_POST, works perfectly. What's the deal, is it fixed? ------------------------------------------------------------------------ [2003-02-21 17:20:39] twjohnso at hotmail dot com I too am having the same issue... here is my info... PHP Version: 4.3.1 (Windows Binary) OS Version: Win2K Pro, SP2 Webserver: IIS MySQL version: 4.0.10 gamma (win32) PHP Settings... file_uploads = On/Off (someone said this helped for them, didnt seem to make a difference for me) register_globals = On/Off (someone said this helped for them, didnt seem to make a difference for me) session support = enabled Regards, Tj ------------------------------------------------------------------------ [2003-01-24 13:14:48] sbeam at rtint dot net ok I will ask Redhat to send the aspirin and cake ------------------------------------------------------------------------ [2003-01-24 13:12:16] sbeam at rtint dot net rant rant rant rant rant rant rant. I have a splitting headache thanks to this bug - thought it was DESIGNED that way until I found this report. You should send out aspirin and cake to everyone who uses Redhat 7.3 as the php RPM as of RIGHT NOW is 4.1.2. ------------------------------------------------------------------------ [2003-01-15 00:33:55] phpbug at bluefootproject dot com OK - Here's what I'm getting on my windows box running PHP 4.0.5 , and also, the simple scripted fix I came up with for it: Symptoms: It looks like the $HTTP_SESSION_VARS array does indeed contain values from the session, but values set in the array during the process are not written into the session. You can only update the session data by modifying the global literals. So: session_register('arse'); $arse = 'working'; Would add $arse to the session data, and the $HTTP_SESSION_VARS; But: $HTTP_SESSION_VARS['arse'] = 'working'; Only adds it to the $HTTP_SESSION_VARS array, and not the actual session data, so the value only exists for the duration of the script execution. ----HERE'S MY FIX---- This works on my scripts: Do a kind of backwards iteration over the $HTTP_SERVER_VARS array at the end of the script. I've placed the following into the end of /cms and /content on my windows machine: // $HTTP_SESSION_VARS bugfix while(list($key , $value) = each($HTTP_SESSION_VARS)){ session_register($key); $$key = $value; } Hope this helps somebody. -- Bluefoot http://bluefootproject.com ------------------------------------------------------------------------ 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 (#37900) next »