ID: 20709 Comment by: matt_00001 at hotmail dot com Reported By: DChri36990 at aol dot com Status: No Feedback Bug Type: Class/Object related Operating System: Windows 2000 PHP Version: 4.2.3 New Comment:
It seems that it was my fault rather then a bug. I had register_globals on which apparently causes $userID to be a references to $_SESSION['userID'] when a session variable of that name exists. My previous comment can be removed. Previous Comments: ------------------------------------------------------------------------ [2008-09-09 21:10:35] matt_00001 at hotmail dot com It looks like this is an old bug report but Ive just run into it again so I don't think that its been fixed. Iam using Apache2.2.4 and PHP5.2.2 on a ubuntu system. What happens is that: 1) $_SESSION['userID'] is set to 1 in another script 2) When the script in question loads the $_SESSION['userID'] variable is set correctly and "echo $_SESSION['userID'];" outputs 1. 3) I assigned the variable $userID a value "$userID = 3;". 4) Now "echo $_SESSION['userID'];" outputs 3 Its possible that Iam doing something wrong here, but Ive checked and I never change any $_SESSION variables in the script in question. It looks like a legitimate bug to me. ------------------------------------------------------------------------ [2008-03-05 16:40:41] tozetre at gmail dot com This just happened to me; a script checked for the existence of $_SESSION['optarr'], and filled data if it was set. The script didn't set the session variable, didn't assign anything to it, and the only place that $_SESSION['optarr'] appeared were in lines that checked if it was set- and I made sure there weren't any accidental assignments during evaluation. However, when I refreshed the page after loading it once, $_SESSION['optarr'] got filled with a bunch of data. What I found was that I was setting $optarr in the script, which contained exactly the same information I was getting in $_SESSION['optarr'] on the reload. So, basically, the first time the script ran it looked for (and, presumably in the process, initialized) $_SESSION['optarr'], then built $optarr, which leaked over into $_SESSION['optarr'], so the second time I ran it, it found $_SESSION['optarr'] full of the data from $optarr. Renaming $optarr to $foooptarr eliminated the problem. Running PHP 5.2.4-pl2-gentoo on Apache 2.2.4-r12 on Linux 2.6.18-gentoo-r7 x86_64 ------------------------------------------------------------------------ [2006-11-21 01:33:33] dpegasusm at gmail dot com i had a similar problem occur in PHP 4.4.4 where i called a variable called $_SESSION['userID'] which had been previously set to the user's ID number. later on in the script i set $userID to a value and it would also set the session variable. strangely this mysterious resetting only happened for one particular instance of setting $userID to a new value. all other times it was reset it didn't affect the session variable. i tried moving the entire site onto a second server to see what happens and it worked fine there. both servers had the exact same configuration. and were running Linux with Apache 1.3.37. ------------------------------------------------------------------------ [2002-12-08 10:19:35] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2002-11-28 22:09:12] [EMAIL PROTECTED] 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 This is something that I believe was fixed in 4.3.0, please try the RC2 and report if the problem persists. Also, is you register_globals on? ------------------------------------------------------------------------ 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/20709 -- Edit this bug report at http://bugs.php.net/?id=20709&edit=1