Re: [PHP4BETA] Is autoregister of HTTP_STATE_VARS possible?

From: Date: Tue, 07 Mar 2000 20:04:47 +0000
Subject: Re: [PHP4BETA] Is autoregister of HTTP_STATE_VARS possible?
References: 1 2 3  Groups: php.version4 
Request: Send a blank email to php-version4+get-11714@lists.php.net to get a copy of this message
On Tue, 07 Mar 2000, Andrei Zmievski wrote: > On Tue, 07 Mar 2000, Shane Burrell wrote: > > After looking at the session code and examining what would take place if > > globals were set to off and track_vars were on I think either setting > > HTTP_STATE_VARS which is not registered should throw an error or > > HTTP_STATE_VARS during a set with global off and track vars on should check to > > see if the var is in session and if not register it. I may be overlooking the > > reason for not doing this. If the latter is correct I'd be glad to help out > > and attempt a patch. > > The reason is that it's not possible for an extension to know that > something was set in the $HTTP_STATE_VARS[] array. > > -Andrei > > Windows 2000 is certified not to crash more than > once a day, so what is the bootup time, 24 hours? > -- Sam Liddicott > In order to keep our global space clean we have attempted to move to using the HTTP_*_VARS instead of checking them into the global scope. When you disable the global checkin of HTTP_*_VARS it breaks most of our code and most other applications. By leaving global on I disable the ability to migrate successfully to the HTTP_*_VARS approach. I am trying to decide which way is best both for performance and readiblity. I would assume that the HTTP_*_VARS only method is the best way to go but I may be wrong. Before migrating to that method I'd like to know that's the way that is recommended. Here are some examples of things I have tried so far and explanations of what they are. Our first try at using session: Globals and Track Vars are both on. It did what we needed but count was global and in group development vars were getting stomped on <?php session_start(); session_register('count'); $count++; echo $count; ?> The way we wished it worked so migration was easy. Globals for only HTTP_POST_VARS and HTTP_GET_VARS on, Track Vars on. This is not possible but would make not only our code work but things like phpmysqladmin work too without using session globals. <?php session_start(); $HTTP_STATE_VARS['count'] = $HTTP_STATE_VARS['count'] + 1; echo $HTTP_STATE_VARS['count']; ?> Globals are off Track Vars are on. This works but breaks all code that doesn't know it should use $HTTP_GET/POST_VARS['varname'] instead of $varname. It also required us to register each HTTP_STATE_VARS I plan on using. During migration everything is broken till all is changed from global vars to HTTP_*_VARS. Other apps like phpmysqladmin won't work till modified. <?php session_start(); session_register('count'); $HTTP_STATE_VARS['count'] = $HTTP_STATE_VARS['count'] + 1; echo $HTTP_STATE_VARS['count']; ?> As to if this is my problem to fix in code, I don't know. I can fix it all but I don't want to if either A) I am doing the wrong thing to begin with or B) For the sake of compatibility the way it currently works changes. Any ideas or direction would be appreciated. If I can be of further assistance in testing or trying things I be happy to. Thanks for everyone's help so far. :)

« previous php.version4 (#11714) next »