[php-src] Issue #10100: array_merge produces a 0 key index when there is none.
| From: | kevindees | Date: | Wed, 14 Dec 2022 04:02:29 +0000 |
| Subject: | [php-src] Issue #10100: array_merge produces a 0 key index when there is none. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243135@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10100
Author: kevindees
### Description
When running
array_merge an index of 0 is created when there is no such
index on any array that is merged. The issue is with a very specific payload. I have been able to
reproduce it consistently. before and after updating PHP, xDebug, and system reboot. M1 Mac.
I have a video of the issue as well, if needed. I can do a Zoom call if needed if someone needs to
look into this and see it in action.
The following code:
```php
<?php
array_merge([
'name' => 'Kevin'
]);
```
Resulted in this output:
```
[
'0' => null,
'name' => 'Kevin'
]
```
But I expected this output instead:
```
[
'name' => 'Kevin'
]
```
<img width="2560" alt="Screenshot 2022-12-13 at 10 44 04 PM" src="https://user-images.githubusercontent.com/348368/207501016-16eb3127-d142-4601-8684-245a836cd4d3.png">
<img width="2560" alt="Screenshot 2022-12-13 at 10 43 45 PM" src="https://user-images.githubusercontent.com/348368/207501020-4f285245-b4f5-4daf-a5be-37f5a79f72a0.png">
<img width="2560" alt="Screenshot 2022-12-13 at 10 42 47 PM" src="https://user-images.githubusercontent.com/348368/207501021-539c393a-bd5b-4518-bc8b-d2a64694dc21.png">
### PHP Version
PHP 8.1.13 and 8.2.0
### Operating System
Mac M1