Trying not to rewrite/revise a lot of code...
(actually been trying to find a way around it - but it will be very ugly...)
I started with a fixed list of variables I would need to access, and did use the 'normal' global statement in the functions. (Example 1)
I then found a need to expand and make the variable names accessed dependent on other variables passed - the number of variables needed and their names will vary based on input - it will raise maintenance issues if every time a new variable is added - a number of functions need to be updated as well.
This led to trying the $GLOBALS array as a means to access the data - and it worked very well.
The concern with register globals being on are the variables 'injected' into the script from the 'egpcs' SuperGlobal arrays - yet the code in Coppermine deletes all entries in $GLOBALS except for a few key variables chosen to save if register globals is on...
I'm still not sure why this affects variables I am setting in a plugin admin script (I would think init.inc.PHP was invoked BEFORE my Admin script, but it is clearly deleting variables I am setting.
The code I proposed addressed 'gpc' though as indicated it could easily accommodate 'es' as well (and should free memory used when done... Revised to address all variables affected by register globals being on:
// Set $strict to false to make the superglobals available
$strict = TRUE;
// Determine any variables introduced by register_globals, if enabled
if ($register_globals_flag) {
$clean_requests = array();
foreach ($_REQUEST as $key => $value) {
$clean_requests[] = $key;
}
foreach ($_ENV as $key => $value) {
$clean_requests[] = $key;
}
foreach ($_SERVER as $key => $value) {
$clean_requests[] = $key;
}
}
$superCage = Inspekt::makeSuperCage($strict);
// Remove any variables introduced by register_globals, if enabled
if ($register_globals_flag) {
foreach ($clean_requests as $key) {
unset($$key);
}
unset($clean_requests);
}
I would think the current code could cause issues in other areas - as I see use of the $GLOBALS variable elsewhere in CPG.
For the moment, I am just detecting that register globals is on and putting out an appropriate message... And still testing.