@@ -3239,18 +3239,19 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
3239
3239
src = Z_ARRVAL_P (arg );
3240
3240
dest = Z_ARRVAL_P (return_value );
3241
3241
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 {
3247
3249
Z_ADDREF_P (src_entry );
3248
3250
}
3251
+ }
3252
+ if (string_key ) {
3249
3253
zend_hash_add_new (dest , string_key , src_entry );
3250
3254
} else {
3251
- if (Z_REFCOUNTED_P (src_entry )) {
3252
- Z_ADDREF_P (src_entry );
3253
- }
3254
3255
zend_hash_index_add_new (dest , idx , src_entry );
3255
3256
}
3256
3257
} ZEND_HASH_FOREACH_END ();
@@ -3279,18 +3280,19 @@ static inline void php_array_merge_or_replace_wrapper(INTERNAL_FUNCTION_PARAMETE
3279
3280
src = Z_ARRVAL_P (arg );
3280
3281
dest = Z_ARRVAL_P (return_value );
3281
3282
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 {
3287
3290
Z_ADDREF_P (src_entry );
3288
3291
}
3292
+ }
3293
+ if (string_key ) {
3289
3294
zend_hash_add_new (dest , string_key , src_entry );
3290
3295
} else {
3291
- if (Z_REFCOUNTED_P (src_entry )) {
3292
- Z_ADDREF_P (src_entry );
3293
- }
3294
3296
zend_hash_next_index_insert_new (dest , src_entry );
3295
3297
}
3296
3298
} ZEND_HASH_FOREACH_END ();
0 commit comments