> -----Original Message-----
> From: Kevin Stone [mailto:[EMAIL PROTECTED]
> Sent: 09 July 2003 20:30
> 
> ----- Original Message -----
> From: "ulf sundin" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, July 09, 2003 1:00 PM
> Subject: Re: [PHP] session data missing
> 
> 
> > ok, so now the variable names are registred and stored in 
> the file. But
> > without values.
> > check this:
> >
> > --firstpage.php----
> > session_start()
> > session_register('foo');
> > $HTTP_SESSION_VARS['foo'] = 'bar';
> > echo $HTTP_SESSION_VARS['foo']; //outputs bar;
> >
> > transport by a href to:
> > ----secondpage.php----
> > session_start();
> > echo $HTTP_SESSION_VARS['foo']; //outputs nothing
> >
> > ---
> > checking the contents of the file called /tmp/sess_{session_id}:
> >  !foo|
> (snip)
> 
> 
> Make a choice here..
> 
> => session_register('foo');
> => $HTTP_SESSION_VARS['foo'] = 'bar';
> 
> Use either the session_register() function or the session 
> global array.  Not
> both.

Not true -- $HTTP_SESSION_VARS is *not* like $_SESSION, and its values are *not* 
auto-registered.  In fact, I still have my copy of the 4.0.6 manual around, and it 
specifically gives this as an example:

> Example 1. Registering a variable 
> 
> <?php
> session_register("count");
> $HTTP_SESSION_VARS["count"]++;
> ?>

However, it's a little unclear on whether this should still work regardless of the 
register_globals setting, as it also gives this as an example:

> Example 2. Registering a variable with register_globals enabled 
> 
> <?php
> session_register("count");
> $count++;
> ?>

I guess I'd have to go away and try it to be sure of what behaviour occurs for each 
setting of register_globals -- but there seems little point given that using $_SESSION 
has been much the best option for several versions now!

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

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

Reply via email to