]> granicus.if.org Git - php/commitdiff
fix #43559 (array_merge_recursive() doesn't behave as expected with duplicate NULL...
authorAntony Dovgal <tony2001@php.net>
Wed, 23 Jan 2008 11:20:00 +0000 (11:20 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 23 Jan 2008 11:20:00 +0000 (11:20 +0000)
patch by Felipe

ext/standard/array.c

index e7345fc1880e3907111462cf71c149e70812e996..2a99e960f09f740ad6cdc423a3462d9ff6cff92c 100644 (file)
@@ -2397,8 +2397,18 @@ ukey:
                                        SEPARATE_ZVAL(dest_entry);
                                        SEPARATE_ZVAL(src_entry);
 
-                                       convert_to_array_ex(dest_entry);
-                                       convert_to_array_ex(src_entry);
+                                       if (Z_TYPE_PP(dest_entry) == IS_NULL) {
+                                               convert_to_array_ex(dest_entry);
+                                               add_next_index_null(*dest_entry);
+                                       } else {
+                                               convert_to_array_ex(dest_entry);
+                                       }
+                                       if (Z_TYPE_PP(src_entry) == IS_NULL) {
+                                               convert_to_array_ex(src_entry);
+                                               add_next_index_null(*src_entry);
+                                       } else {
+                                               convert_to_array_ex(src_entry);
+                                       }
                                        if (thash) {
                                                thash->nApplyCount++;
                                        }