diff options
author | Zeev Suraski <zeev@php.net> | 2003-07-22 16:08:50 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 2003-07-22 16:08:50 +0000 |
commit | 0a49c033d096688bf232ff13fb8217917a6c0ebd (patch) | |
tree | 718ab8800de08fbe773667c02a30f6b0bebbb347 /main/php_variables.c | |
parent | cf90932a05b03354fdf6b844ff3a6902fc51a928 (diff) | |
download | php-git-0a49c033d096688bf232ff13fb8217917a6c0ebd.tar.gz |
- Use the new infrastructure of zend_symtable_*() (fixes bug #24565)
- Fix bogus use of get_current_key()
Diffstat (limited to 'main/php_variables.c')
-rw-r--r-- | main/php_variables.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index 49d9d0aad5..6415c16345 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -152,11 +152,11 @@ PHPAPI void php_register_variable_ex(char *var, zval *val, pval *track_vars_arra } else { escaped_index = index; } - if (zend_hash_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE + if (zend_symtable_find(symtable1, escaped_index, index_len+1, (void **) &gpc_element_p)==FAILURE || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { MAKE_STD_ZVAL(gpc_element); array_init(gpc_element); - zend_hash_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_symtable_update(symtable1, escaped_index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } if (index!=escaped_index) { efree(escaped_index); @@ -182,7 +182,7 @@ plain_var: if (!index) { zend_hash_next_index_insert(symtable1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } else { - zend_hash_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + zend_symtable_update(symtable1, index, index_len+1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); } break; } @@ -498,20 +498,20 @@ static inline void php_register_server_variables(TSRMLS_D) */ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) { - zval **src_entry, **dest_entry; - char *string_key; - uint string_key_len; - ulong num_key; - HashPosition pos; - int key_type; + zval **src_entry, **dest_entry; + char *string_key; + uint string_key_len; + ulong num_key; + HashPosition pos; + int key_type; zend_hash_internal_pointer_reset_ex(src, &pos); while (zend_hash_get_current_data_ex(src, (void **)&src_entry, &pos) == SUCCESS) { key_type = zend_hash_get_current_key_ex(src, &string_key, &string_key_len, &num_key, 0, &pos); - if (Z_TYPE_PP(src_entry) != IS_ARRAY || - (string_key_len && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) != SUCCESS) || - (!string_key_len && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) - || Z_TYPE_PP(dest_entry) != IS_ARRAY) { + if (Z_TYPE_PP(src_entry) != IS_ARRAY + || (key_type==HASH_KEY_IS_STRING && zend_hash_find(dest, string_key, string_key_len, (void **) &dest_entry) != SUCCESS) + || (key_type==HASH_KEY_IS_LONG && zend_hash_index_find(dest, num_key, (void **)&dest_entry) != SUCCESS) + || Z_TYPE_PP(dest_entry) != IS_ARRAY) { (*src_entry)->refcount++; if (key_type == HASH_KEY_IS_STRING) { zend_hash_update(dest, string_key, strlen(string_key)+1, src_entry, sizeof(zval *), NULL); |