summaryrefslogtreecommitdiff
path: root/main/php_variables.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2014-05-07 16:52:58 +0800
committerXinchen Hui <laruence@php.net>2014-05-07 16:52:58 +0800
commited5b6af8af6a0b8c331e692cd0a81daeef59dcff (patch)
tree194de70013427ca022b98b1913f119c53a69d25a /main/php_variables.c
parent8b90b17c8d7cc3def0d81256a021a7e86a2401a1 (diff)
downloadphp-git-ed5b6af8af6a0b8c331e692cd0a81daeef59dcff.tar.gz
Refactored filter
Diffstat (limited to 'main/php_variables.c')
-rw-r--r--main/php_variables.c9
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 {