mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Fixed bug #24198 (Invalid recursion detection in array_merge_recurcive())
This commit is contained in:
parent
1a290fb692
commit
6057160dbf
@ -2141,7 +2141,7 @@ PHPAPI int php_array_merge(HashTable *dest, HashTable *src, int recursive TSRMLS
|
||||
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;
|
||||
}
|
||||
|
25
ext/standard/tests/array/bug24198.phpt
Normal file
25
ext/standard/tests/array/bug24198.phpt
Normal file
@ -0,0 +1,25 @@
|
||||
--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"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user