]> granicus.if.org Git - php/commitdiff
Entries registered with session_register() and altered by changing
authorZeev Suraski <zeev@php.net>
Sat, 24 Nov 2001 02:14:45 +0000 (02:14 +0000)
committerZeev Suraski <zeev@php.net>
Sat, 24 Nov 2001 02:14:45 +0000 (02:14 +0000)
$_SESSION (or $HTTP_SESSION_VARS) were not properly saved.  Fixed.

ext/session/session.c

index ab9d3a3f90bd1ea8663f8c4b2f63824aba419c67..676ff51899d0f01739c2cf4c26e0bfd01aa74e31 100644 (file)
@@ -261,7 +261,6 @@ typedef struct {
 
 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) { 
@@ -295,14 +294,15 @@ void php_set_session_var(char *name, size_t namelen, zval *state_val, php_unseri
 
 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