RC manipulation cleanup

This commit is contained in:
Xinchen Hui 2017-11-01 10:25:10 +08:00
parent 0056f52f50
commit a8a17a72b0
16 changed files with 168 additions and 408 deletions

View file

@ -663,15 +663,13 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src)
|| (string_key && (dest_entry = zend_hash_find(dest, string_key)) == NULL)
|| (string_key == NULL && (dest_entry = zend_hash_index_find(dest, num_key)) == NULL)
|| Z_TYPE_P(dest_entry) != IS_ARRAY) {
if (Z_REFCOUNTED_P(src_entry)) {
Z_ADDREF_P(src_entry);
}
Z_TRY_ADDREF_P(src_entry);
if (string_key) {
if (!globals_check || ZSTR_LEN(string_key) != sizeof("GLOBALS") - 1
|| memcmp(ZSTR_VAL(string_key), "GLOBALS", sizeof("GLOBALS") - 1)) {
zend_hash_update(dest, string_key, src_entry);
} else if (Z_REFCOUNTED_P(src_entry)) {
Z_DELREF_P(src_entry);
} else {
Z_TRY_DELREF_P(src_entry);
}
} else {
zend_hash_index_update(dest, num_key, src_entry);