[php-src] Issue #9848: Array construct/destruct should warn at least for duplicate keys
| From: | mvorisek | Date: | Sat, 29 Oct 2022 10:29:07 +0000 |
| Subject: | [php-src] Issue #9848: Array construct/destruct should warn at least for duplicate keys | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242705@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9848
Author: mvorisek
### Description
```
$arr = ['4', 'x' => 5];
// construct with duplicate keys
var_dump(['x' => 4, 'x' => 6]);
var_dump([2 => 4, 2.0 => 6]);
// spread operator leading to duplicate keys
var_dump(['x' => 4, ...$arr]);
// destruct with duplicate keys
['x' => $a, 'x' => $b] = ['x' => 10];
var_dump([$a, $b]);
```
https://3v4l.org/NTFPM
all cases should emit at least warning if not an error