Re: session bug or feature
| From: | Christian Calloway | Date: | Fri, 08 Aug 2003 10:25:55 +0000 |
| Subject: | Re: session bug or feature | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-158861@lists.php.net to get a copy of this message | ||
register_global is currently on. The problem is, I am hacking into someone
else's (awful awful) code, and if I turned off register_globals, the whole
application would go kaput. I am not even using the old session_x functions,
just the new associative session array $_SESSION.
"Curt Zirzow" <curt@zirzow.dyndns.org> wrote in message
news:20030807171325.GZ21938@bagend.shire...
> * 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."