mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: [ci skip] NEWS for GH-16061 Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
This commit is contained in:
commit
3952a8f9f1
2 changed files with 30 additions and 1 deletions
|
@ -4037,7 +4037,6 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
|
|||
}
|
||||
|
||||
ZEND_ASSERT(!Z_ISREF_P(dest_entry) || Z_REFCOUNT_P(dest_entry) > 1);
|
||||
SEPARATE_ZVAL(dest_entry);
|
||||
dest_zval = dest_entry;
|
||||
|
||||
if (Z_TYPE_P(dest_zval) == IS_NULL) {
|
||||
|
@ -4046,6 +4045,8 @@ PHPAPI int php_array_merge_recursive(HashTable *dest, HashTable *src) /* {{{ */
|
|||
} else {
|
||||
convert_to_array(dest_zval);
|
||||
}
|
||||
SEPARATE_ZVAL(dest_zval);
|
||||
|
||||
ZVAL_UNDEF(&tmp);
|
||||
if (Z_TYPE_P(src_zval) == IS_OBJECT) {
|
||||
ZVAL_COPY(&tmp, src_zval);
|
||||
|
|
28
ext/standard/tests/array/gh16053.phpt
Normal file
28
ext/standard/tests/array/gh16053.phpt
Normal file
|
@ -0,0 +1,28 @@
|
|||
--TEST--
|
||||
GH-16053: Assertion failure in Zend/zend_hash.c
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class test
|
||||
{
|
||||
}
|
||||
$x = new test;
|
||||
$arr1 = array("string" => $x);
|
||||
$arr2 = array("string" => "hello");
|
||||
var_dump($arr1);
|
||||
var_dump(array_merge_recursive($arr1, $arr2));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
array(1) {
|
||||
["string"]=>
|
||||
object(test)#%d (0) {
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
["string"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(5) "hello"
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue