[nycphp-talk] retro php
Kenneth Dombrowski
kenneth at ylayali.net
Tue Oct 14 16:33:23 EDT 2003
On 03-10-14 11:42 -0400, Kenneth Dombrowski wrote:
>
> on page 1, index.php
>
> $HTTP_SESSION_VARS['S_user_id'] = $rs['user_id'];
> $HTTP_SESSION_VARS['S_login_name'] = $rs['login'];
> $HTTP_SESSION_VARS['S_company_id'] = $rs['company_id'];
> $HTTP_SESSION_VARS['S_user_email'] = $rs['email'];
>
about 16 hrs. later... "oh, i get it!"
it's like when I try and assign stuff in bash like this:
$NEWVAR='value'
aside from the above, I was trying
session_register('S_user_id');
$HTTP_SESSION_VARS['S_user_id'] = $something;
or even
session_register($HTTP_SESSION_VARS['S_user_id'])
etc..
but what finally works is just (back where I started from)
session_register('S_user_id');
$S_user_id = $something
and later accessing it with
$HTTP_SESSION_VARS['S_user_id']
though, after session_register, I'm not sure what the point of that
would be with regiater_globals on.. unless it's to be didactic about
where your variables are coming from.. which I like to be anyway.
all of which seems to directly contradict the session_register page Dan
quoted to me earlier:
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use
session_register(), session_is_registered(), and
session_unregister().
... snip ...
You can also create a session variable by simply setting the
appropriate member of the $_SESSION or $HTTP_SESSION_VARS (PHP <
4.1.0) array.
& which *still* implies to me that the above should've worked (as it did
on later versions). Maybe it really is just an obscure 4.0.6 bug, at
least I had a history lesson, I guess.
Regarding that quote of Dan's though, what initially prompted me to take
out all of the register_globals & friends was rendering/garbled header
problems when I began to mix them with $_SESSION syntax, which you can
see the results of (on PHP 4.2.2/Apache 2/Red Hat 9, but also seen on
the 4.0.6/Apache 1.3/Some Earlier Red Hat machine) here:
http://dev.ylayali.net/~kenneth/images/superglobal_and_register_session.jpg
I guess it remains to be seen if that behavior will come back as a
result of mixing session_register() with $HTTP_SESSION_VARS
Thanks again,
Kenneth
More information about the talk
mailing list