public void RegisterSessionGlobals()
{
PhpArray globals, session;
// do not create session variables table if not exists:
if ((session = PhpReference.AsPhpArray(AutoGlobals.Session)) == null)
return;
// creates globals array if it doesn't exists:
globals = GlobalVariables;
// iterates using unbreakable enumerator:
foreach (KeyValuePair<IntStringKey, object> entry in session)
{
PhpReference php_ref = entry.Value as PhpReference;
// converts the session variable to a reference if it is not one ("no duplicate pointers" rule preserved):
if (php_ref == null)
session[entry.Key] = php_ref = new PhpReference(entry.Value);
// adds alias to the globals:
globals[entry.Key] = php_ref;
}
}