Yeah I figured as much. That sucks that they would both reference the same
location in memory even with globals on. Thanks alot for your help, ill
figure out a hack around the hack.

Christian Calloway

"Kirk Johnson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Under 4.3.2, and register_globals on, $foo and $_SESSION["foo"] both
contain
> a reference that points to the same memory location. So, assigning to
either
> one effectively causes the same assignment in the other.
>
> If you can't turn register_globals off, consider making a copy of
$_SESSION
> at the top of the script, then use that copy at the end of the script to
> restore any session values you need. You could also rename the global
> variables, e.g., "$foo" -> "$g_foo".
>
> I don't see an easy way out if you can't turn off register_globals, you
are
> going to have to do some work.
>
> Kirk
>
>
> > 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" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > * Thus wrote Christian Calloway ([EMAIL PROTECTED]):
> > > > 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"?!



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to