Re: [Phplib-users] php4 session fix, and some thoughts
Brought to you by:
nhruby,
richardarcher
|
From: Lindsay H. <fmo...@fm...> - 2003-01-23 20:28:12
|
Thus spake Joe Stewart on Thu, Jan 23, 2003 at 01:42:43PM CST
> > ## Load the auto_init-File, if one is specified.
> > $sess->register('phplib_sess_in'); #1
> > if ($GLOBALS['phplib_sess_in'] == 1) { #2
> > $sess->in =1; #3
> > } #4
> > if (($sess->auto_init != "") && !$sess->in) {
> > $sess->in = 1;
> > $GLOBALS['phplib_sess_in'] = 1; #5
> > if (substr($sess->auto_init,0,1) == '/')
> > include($sess->auto_init);
> > else
> > include($_PHPLIB["libdir"] . $sess->auto_init);
> > if ($sess->secure_auto_init != "") {
> > $sess->freeze();
> > }
> > }
This would probably work (although I haven't tested it either). I think it
would be more scalable to make keeping track of session business the
responsibility of the Session class rather than the effective constructor
for the Page class, but if we're going this route, and $sess->in is to be
depreciated, the above code could be simplified further still.
I do have some concern with implications of the fact that the global name
space must be used to reference all persistent data under php4 session
management. I think there needs to be a naming convention established for a
reserved global name space in phplib. For instance, we might say that all
variables which phplib uses for its own internal record keeping must start
with $_PHPLIB or something similar. This could be part of the published API
so that applications could avoid tromping on internal variables. It's
concievable, considering the above patch, that someone might write an app
that unknowingly used the name $phplib_sess_in for a global variable.
This is what I was trying to do by encapsulating the auto_init flag in a
class of its own whose objects were identified with session_id(). As I
noted, this may be overkill. I did consider a solution as simple as the
above patch.
--
Lindsay Haisley | "Everything works | PGP public key
FMP Computer Services | if you let it" | available at
512-259-1190 | (The Roadie) | <http://www.fmp.com/pubkeys>
http://www.fmp.com | |
|