iliaa Mon Jun 16 13:35:16 2003 EDT
Added files:
/php4/ext/standard/tests/array bug24198.phpt
Modified files:
/php4/ext/standard array.c
Log:
Fixed bug #24198 (Invalid recursion detection in array_merge_recurcive())
Index: php4/ext/standard/array.c
diff -u php4/ext/standard/array.c:1.233 php4/ext/standard/array.c:1.234
--- php4/ext/standard/array.c:1.233 Thu Jun 12 11:11:11 2003
+++ php4/ext/standard/array.c Mon Jun 16 13:35:16 2003
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.233 2003/06/12 15:11:11 andrey Exp $ */
+/* $Id: array.c,v 1.234 2003/06/16 17:35:16 iliaa Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2141,7 +2141,7 @@
case HASH_KEY_IS_STRING:
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)) {
php_error_docref(NULL TSRMLS_CC,
E_WARNING, "recursion detected");
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