iliaa Mon Jun 16 13:37:16 2003 EDT Added files: (Branch: PHP_4_3) /php4/ext/standard/tests/array bug24198.phpt
Modified files: /php4/ext/standard array.c Log: MFH: Fixed bug #24198 (Invalid recursion detection in array_merge_recurcive()) Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.199.2.19 php4/ext/standard/array.c:1.199.2.20 --- php4/ext/standard/array.c:1.199.2.19 Sun May 11 02:39:42 2003 +++ php4/ext/standard/array.c Mon Jun 16 13:37:15 2003 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.199.2.19 2003/05/11 06:39:42 moriyoshi Exp $ */ +/* $Id: array.c,v 1.199.2.20 2003/06/16 17:37:15 iliaa Exp $ */ #include "php.h" #include "php_ini.h" @@ -2001,7 +2001,7 @@ if (recursive && zend_hash_find(dest, string_key, string_key_len, (void **)&dest_entry) == SUCCESS) { - if (*src_entry == *dest_entry) { + if (*src_entry == *dest_entry && ((*dest_entry)->refcount % 2)) { zend_error(E_WARNING, "%s(): recursion detected", get_active_function_name(TSRMLS_C)); return 0; Index: php4/ext/standard/tests/array/bug24198.phpt +++ php4/ext/standard/tests/array/bug24198.phpt --TEST--n Bug #24198 (array_merge_recursive() invalid recursion detection) --FILE-- <?php $c = array('a' => 'aa','b' => 'bb'); var_dump(array_merge_recursive($c, $c)); ?> --EXPECT-- array(2) { ["a"]=> array(2) { [0]=> string(2) "aa" [1]=> string(2) "aa" } ["b"]=> array(2) { [0]=> string(2) "bb" [1]=> string(2) "bb" } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php