Skip to content

Commit 2ce190b

Browse files
committed
Merge branch 'master' of http://git.php.net/repository/php-src
2 parents 74c06a6 + b602495 commit 2ce190b

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

ext/standard/array.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,18 +3239,19 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
32393239
src = Z_ARRVAL_P(arg);
32403240
dest = Z_ARRVAL_P(return_value);
32413241
ZEND_HASH_FOREACH_KEY_VAL(src, idx, string_key, src_entry) {
3242-
if (UNEXPECTED(Z_ISREF_P(src_entry) && Z_REFCOUNT_P(src_entry) == 1)) {
3243-
src_entry = Z_REFVAL_P(src_entry);
3244-
}
3245-
if (string_key) {
3246-
if (Z_REFCOUNTED_P(src_entry)) {
3242+
if (Z_REFCOUNTED_P(src_entry)) {
3243+
if (UNEXPECTED(Z_ISREF_P(src_entry) && Z_REFCOUNT_P(src_entry) == 1)) {
3244+
src_entry = Z_REFVAL_P(src_entry);
3245+
if (Z_REFCOUNTED_P(src_entry)) {
3246+
Z_ADDREF_P(src_entry);
3247+
}
3248+
} else {
32473249
Z_ADDREF_P(src_entry);
32483250
}
3251+
}
3252+
if (string_key) {
32493253
zend_hash_add_new(dest, string_key, src_entry);
32503254
} else {
3251-
if (Z_REFCOUNTED_P(src_entry)) {
3252-
Z_ADDREF_P(src_entry);
3253-
}
32543255
zend_hash_index_add_new(dest, idx, src_entry);
32553256
}
32563257
} ZEND_HASH_FOREACH_END();
@@ -3279,18 +3280,19 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
32793280
src = Z_ARRVAL_P(arg);
32803281
dest = Z_ARRVAL_P(return_value);
32813282
ZEND_HASH_FOREACH_STR_KEY_VAL(src, string_key, src_entry) {
3282-
if (UNEXPECTED(Z_ISREF_P(src_entry) && Z_REFCOUNT_P(src_entry) == 1)) {
3283-
src_entry = Z_REFVAL_P(src_entry);
3284-
}
3285-
if (string_key) {
3286-
if (Z_REFCOUNTED_P(src_entry)) {
3283+
if (Z_REFCOUNTED_P(src_entry)) {
3284+
if (UNEXPECTED(Z_ISREF_P(src_entry) && Z_REFCOUNT_P(src_entry) == 1)) {
3285+
src_entry = Z_REFVAL_P(src_entry);
3286+
if (Z_REFCOUNTED_P(src_entry)) {
3287+
Z_ADDREF_P(src_entry);
3288+
}
3289+
} else {
32873290
Z_ADDREF_P(src_entry);
32883291
}
3292+
}
3293+
if (string_key) {
32893294
zend_hash_add_new(dest, string_key, src_entry);
32903295
} else {
3291-
if (Z_REFCOUNTED_P(src_entry)) {
3292-
Z_ADDREF_P(src_entry);
3293-
}
32943296
zend_hash_next_index_insert_new(dest, src_entry);
32953297
}
32963298
} ZEND_HASH_FOREACH_END();

0 commit comments

Comments
 (0)