Hey, is there some reason that using something like this isn't working?

[ses1.php]
<?
        session_start();
        session_register('test');
        $HTTP_SESSION_VARS['test'] = 'Testing';
        echo $HTTP_SESSION_VARS['test'];
?>

[ses2.php]
<?
   session_start();
   echo $HTTP_SESSION_VARS['test'];
?>

ie. ses1.php starts a session and registers $test to be a session var and
then I define it in in the $HTTP_SESSION_VARS array.  ses2.php simply
prints the value.  With register_globals turned off this works perfectly,
but with it on it doesn't.

I think the $HTTP_SESSION_VARS approach should work regardless of the
register_globals setting.  Or is there some reason for not having it work
when register_globals is on?

Looks like this code in session.c is the culprit:

int php_get_session_var(char *name, size_t namelen, zval ***state_var PLS_DC PSLS_DC 
ELS_DC)
{
        HashTable *ht = &EG(symbol_table);

        if (!PG(register_globals))
                ht = Z_ARRVAL_P(PS(http_session_vars));

        return zend_hash_find(ht, name, namelen + 1, (void **)state_var);
}

http_session_vars is only checked if register_globals is off.

-Rasmus


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to