diff options
author | Xinchen Hui <laruence@php.net> | 2014-05-07 16:52:58 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2014-05-07 16:52:58 +0800 |
commit | ed5b6af8af6a0b8c331e692cd0a81daeef59dcff (patch) | |
tree | 194de70013427ca022b98b1913f119c53a69d25a /main/php_variables.c | |
parent | 8b90b17c8d7cc3def0d81256a021a7e86a2401a1 (diff) | |
download | php-git-ed5b6af8af6a0b8c331e692cd0a81daeef59dcff.tar.gz |
Refactored filter
Diffstat (limited to 'main/php_variables.c')
-rw-r--r-- | main/php_variables.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/main/php_variables.c b/main/php_variables.c index 547dbd5582..c67642c76f 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -635,13 +635,14 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src TSRMLS_DC) if (Z_TYPE_P(src_entry) != IS_ARRAY || (key_type == HASH_KEY_IS_STRING && (dest_entry = zend_hash_find(dest, string_key)) == NULL) || (key_type == HASH_KEY_IS_LONG && (dest_entry = zend_hash_index_find(dest, num_key)) == NULL) - || Z_TYPE_P(dest_entry) != IS_ARRAY - ) { - Z_ADDREF_P(src_entry); + || Z_TYPE_P(dest_entry) != IS_ARRAY) { + if (Z_REFCOUNTED_P(src_entry)) { + Z_ADDREF_P(src_entry); + } if (key_type == HASH_KEY_IS_STRING) { if (!globals_check || string_key->len != sizeof("GLOBALS") || memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) { zend_hash_update(dest, string_key, src_entry); - } else { + } else if (Z_REFCOUNTED_P(src_entry)) { Z_DELREF_P(src_entry); } } else { |