Re: session bug or feature

From: Date: Thu, 07 Aug 2003 17:13:25 +0000
Subject: Re: session bug or feature
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158687@lists.php.net to get a copy of this message
* Thus wrote Christian Calloway (callowaylc@yahoo.com): > Hey Everyone, > > I am running Apache 2.047 with PHP (as module) 4.3.2. I ran into something > interesting and I wanted to know if it was a bug, or actually supposed to be > that way. Given the following lines of code: > > <?php > > session_start(); > > // lets say this equals "bar" and it was set on a previous page > $_SESSION["foo"]; > > $foo = "rab"; > > > echo $_SESSION["foo"]; > > ?> > > The problem is, when I set the global variable $foo="rab", when I echo the > session variable $_SESSION["foo"], it outputs "rab" instead of > "bar"?! This > doesn't seem right? If that is the intended behavior, is there anyway to > avoid this (perhaps a php.ini directive)? It was a nightmare finding out why > my session variables values were being changed by like-named global > variables ;-) Hey PHP still rocks though, later ---- php4-3.3RC1 Apache 1.3 register_globals: off ---- Hm.. I can't reproduce that, what are you're php settings that affect session stuff, and your register_globals setting? My guess is that you have a session_register('foo') somewhere. Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#158687) next »