void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unserialize_data_t *var_hash TSRMLS_DC)
{
-
if (PG(register_globals)) {
zval **old_symbol;
if (zend_hash_find(&EG(symbol_table),name,namelen+1,(void *)&old_symbol) == SUCCESS) {
int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC)
{
- HashTable *ht = &EG(symbol_table);
-
- if (!PG(register_globals))
- ht = PS(http_session_vars) ? Z_ARRVAL_P(PS(http_session_vars)) : NULL;
-
- if (!ht) return HASH_KEY_NON_EXISTANT;
-
- return zend_hash_find(ht, name, namelen + 1, (void **)state_var);
+ if (PS(http_session_vars)) {
+ if (zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen+1, (void **) state_var)==SUCCESS) {
+ return SUCCESS;
+ }
+ } else if (!PG(register_globals)) {
+ /* register_globals is disabled, but we don't have http_session_vars */
+ return HASH_KEY_NON_EXISTANT;
+ }
+ return zend_hash_find(&EG(symbol_table), name, namelen+1, (void **) state_var);
}
#define PS_BIN_NR_OF_BITS 8