Session variables driving me nuts
| From: | Papo Napolitano | Date: | Wed, 07 Nov 2001 23:02:07 +0000 |
| Subject: | Session variables driving me nuts | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73819@lists.php.net to get a copy of this message | ||
Hi all,
I'm having the most annoying weird and fu**ing bug I've ever though of.
I've like 9 session variables I use inside my site, now PHP has decided to
mess around with 2 of them. What do I mean with "mess"? Keep reading...
I tracked down the "bug" as follows:
1) Register a variable and set it once.
$TEST = 123456;
2) Put a die(); somewhere in the code.
3) Go to /tmp on the filesystem, search for the session file, view it.
LOCATION|s:0:"";USERDATA|a:18:{s:4:"TIPO";i:0;s:3:"UID";s:11:"33658294739";s
:3:"IDX";s:3:"287";s:5:"IDXJ1";s:2:"44";s:5:"IDXJ2";s:1:
"0";s:5:"IDXJ3";s:1:"0";s:7:"CELDAN1";s:0:"";s:6:"CELDAF";s:
1:"2";s:6:"CELDAV";s:2:"37";s:4:"IDXZ";s:1:"2";s:5:"NIVEL";s:
1:"0";s:3:"MES";i:2;s:5:"GRUPO";s:1:"0";}LOGERROR|i:0;ROOTMODE|i:1;FORUMIDX|
i:5;BROWSER|i:0;BACK|s:10:"forum.list";TEST|i:123456;
4) Move the die() a few lines forward
5) See the session file again
(same file)
6) Repeat 4 & 5 a few more times until the session file looks like this:
LOCATION|s:0:"";USERDATA|a:18:{s:4:"TIPO";i:0;s:3:"UID";s:11:"33658294739";s
:3:"IDX";s:3:"287";s:5:"IDXJ1";s:2:"44";s:5:"IDXJ2";s:1:
"0";s:5:"IDXJ3";s:1:"0";s:7:"CELDAN1";s:0:"";s:6:"CELDAF";s:
1:"2";s:6:"CELDAV";s:2:"37";s:4:"IDXZ";s:1:"2";s:5:"NIVEL";s:
1:"0";s:3:"MES";i:2;s:5:"GRUPO";s:1:"0";}LOGERROR|i:0;ROOTMODE|i:1;FORUMIDX|
i:0;BROWSER|i:0;BACK|s:10:"forum.list";TEST|i:0;
AHA! FORUMIDX & TEST went automagically to 0.
And I'm pretty sure I'M NOT EVEN USING $TEST ANYWERE IN THE CODE!!!!
The weird thing is If I remove the die() and put a "echo $TEST" as the last
line of the code, it gets printed as... guess... 123456!!!!
WTF????
My question is... Why only two of the variables get "lost"? And why they get
lost AFTER the script has finished??
OH, and it also sets one item of an array to 0.
Am I being clear? English is a foreign language to me, and this is another
"see to believe" thing.
Thanks in advance =)