Using $HTTP_SESSION_VARS with register_globals On

From: Date: Mon, 21 May 2001 21:25:58 +0000
Subject: Using $HTTP_SESSION_VARS with register_globals On
Groups: php.dev 
Request: Send a blank email to php-dev+get-56129@lists.php.net to get a copy of this message
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

« previous php.dev (#56129) next »