cvs: php-src(PHP_5_3) /ext/standard array.c /ext/standard/tests/array array_merge_recursive_variation5.phpt
| From: | Antony Dovgal | Date: | Wed, 23 Jan 2008 12:09:52 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/standard array.c /ext/standard/tests/array array_merge_recursive_variation5.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-47954@lists.php.net to get a copy of this message | ||
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++;
}