summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-05-21 22:56:59 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-05-21 22:56:59 +0000
commit5298fd625620c54fdb7dc94ec7f2db614b43bae6 (patch)
tree58bf5570a580fe647c2ec04647a38eb9b8a35c7a
parent402f5f7a0de412d330a14a60396d7169c075252a (diff)
downloadphp-git-5298fd625620c54fdb7dc94ec7f2db614b43bae6.tar.gz
MFB
-rw-r--r--main/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/main/main.c b/main/main.c
index 79304ffa1f..2b39571010 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1521,12 +1521,15 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC)
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 || (zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) != SUCCESS) || Z_TYPE_PP(dest_entry) != IS_ARRAY) {
+ 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) {
(*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);
} else {
- zend_hash_next_index_insert(dest, src_entry, sizeof(zval *), NULL);
+ zend_hash_index_update(dest, num_key, src_entry, sizeof(zval *), NULL);
}
} else {
SEPARATE_ZVAL(dest_entry);