Re: this code unsets $_SESSION['editor'] but doesn't touch any other session variables
| From: | Raquel Rice | Date: | Sun, 07 Sep 2003 19:53:32 +0000 |
| Subject: | Re: this code unsets $_SESSION['editor'] but doesn't touch any other session variables | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161930@lists.php.net to get a copy of this message | ||
On Sun, 07 Sep 2003 13:42:21 -0400
"John W. Holmes" <holmes072000@charter.net> wrote:
> anders thoresson wrote:
>
> > Hi,
> >
> > I've had troubles with an application that randomly (until now)
> > unsets the session variable $_SESSION['editor']. I've hunted
> > through all my code and finally managed to rule out everything
> > else than the following couple of lines.
> >
> > It unsets the session variable $_SESSION['editor'], but leaving
> > others, like $_SESSION['admin'] untouched. At the first debug, I
> > get "Admin: Y Editor: Y" printed (which is the way I suppose
> > things to be), but at the second debug I just get "Admin: Y
> > Editor:".
>
> [snip]
> > while ($editor = mysql_fetch_row($editorresult))
> [snip]
>
> You more than likely have register globals ON, so by setting
> $editor to some value above, you are also changing the value of
> $_SESSION['editor'].
>
> --
> ---John Holmes...
How about changing from an assignment operator "=" to a comparison
operator "==".
--
Raquel
============================================================
Discontent is the first step in the progress of a man or a nation.
--Oscar Wilde