[php-src] Issue #19217: array_diff_assoc BUG
| From: | sujrex | Date: | Wed, 23 Jul 2025 03:41:34 +0000 |
| Subject: | [php-src] Issue #19217: array_diff_assoc BUG | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250478@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/19217
Author: sujrex
### Description
The following code:
### on php8.x
```php
<?php
$array1 = array("111" => ["color" => "green"]);
$array2 = array("111" => ["color" => "green"]);
$result = array_diff_assoc($array1, $array2);
print_r($result);
```
Resulted in this output:
```
Warning: Array to string conversion in script on line 4
Warning: Array to string conversion in script on line 4
Array
(
)
```
But I expected this output instead:
```
Array
(
)
```
### on php7.4
```php
<?php
$array1 = array("111" => ["color" => "green"]);
$array2 = array("111" => ["color" => "green"]);
$result = array_diff_assoc($array1, $array2);
print_r($result);
```
Resulted in this output:
```
Array
(
)
```
期待结果为:无论那个版本,当比较数组一致时,比较不应该报错,输出位空数组即可
Expect the result to be: no matter which version, when the comparison array is consistent, the
comparison should not report an error, and the output bit empty array can be
### PHP Version
```plain
PHP 8.x
```
### Operating System
windows or linux