note 82567 added to security.globals
| From: | fab dot mariotti at [google] | Date: | Wed, 16 Apr 2008 19:59:43 +0000 |
| Subject: | note 82567 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138378@lists.php.net to get a copy of this message | ||
For my application I defined two functions:
wit_set_gv('space','key','value')
wit_get_gv('space','key')
Forgive the "wit_" prefix but the gv stays for Global Variable.
Maybe I should start with a simple version:
wit_set_gv('key','value')
wit_get_gv('key')
This way you would set or get a global/session value.
The register_globals (on or off), session state and/or
superglobal variables will be handled by these functions.
I did add a 'space' item because I wanted to have control
on what goes to/comes from where. As an example if I call:
wit_get_gv('WIT_CONF','URL')
I know that I have to check for a global variable named
WIT_CONF which also gives me a positive responce
on isset($WIT_CONF['URL']). In this case $WIT_CONF
is global and static. But I can also set up a $WIT_STATE
variable which will represent the state of the transaction.
Using the code of WIT_set_gv() and WIT_get_gv(), with the help
of a simple few lines (in my case: include globals.inc.php)
definition script I handle this problem.
In my case, for example, if 'WIT_STATE' (or other names)
is not a defined globally available variable I default to check
for a session variable.
For example you might warn or stop if a requested named variable
matches a $_POST, $_GET or $_SESSION variable name while you
do not expect so. i.e. all my private data has a wit_ prefix
but no public request has (shouldn't have) this prefix.
Oopss. I do realize that this comment might not be in the proper
place. i.e. "register_globals". Indeed it might give some advice
to users still using register_globals and willing to change the
code for a "better" solution. Of course
the simple switching to "register_globals = off" might not
solve
the securities issues.
Cheers
F
----
Server IP: 194.153.94.10
Probable Submitter: 77.56.65.168
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- https://master.php.net/note/edit/82567
Del: integrated -- https://master.php.net/note/delete/82567/integrated
Del: useless -- https://master.php.net/note/delete/82567/useless
Del: bad code -- https://master.php.net/note/delete/82567/bad+code
Del: spam -- https://master.php.net/note/delete/82567/spam
Del: non-english -- https://master.php.net/note/delete/82567/non-english
Del: in docs -- https://master.php.net/note/delete/82567/in+docs
Del: other reasons-- https://master.php.net/note/delete/82567
Reject -- https://master.php.net/note/reject/82567
Search -- https://master.php.net/manage/user-notes.php