tony2001                Wed Jan 23 12:09:52 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard/tests/array   
                                        array_merge_recursive_variation5.phpt 
    /php-src/ext/standard       array.c 
  Log:
  MFH: fix #43559 (array_merge_recursive() doesn't behave as expected with 
duplicate NULL values)
  patch by Felipe
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt
diff -u 
php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt:1.1.2.2 
php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt:1.1.2.3
--- 
php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt:1.1.2.2  
    Tue Dec 11 09:07:41 2007
+++ php-src/ext/standard/tests/array/array_merge_recursive_variation5.phpt      
Wed Jan 23 12:09:52 2008
@@ -374,8 +374,10 @@
   object(classA)#%d (0) {
   }
   ["string"]=>
-  array(1) {
+  array(2) {
     [0]=>
+    NULL
+    [1]=>
     string(5) "hello"
   }
   ["resource"]=>
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.14&r2=1.308.2.21.2.37.2.15&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.14 
php-src/ext/standard/array.c:1.308.2.21.2.37.2.15
--- php-src/ext/standard/array.c:1.308.2.21.2.37.2.14   Mon Jan 14 22:09:52 2008
+++ php-src/ext/standard/array.c        Wed Jan 23 12:09:52 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.37.2.14 2008/01/14 22:09:52 shire Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37.2.15 2008/01/23 12:09:52 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -2197,8 +2197,18 @@
                                        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++;
                                        }

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to