[php-src] Issue #10159: PHP silently merge the duplicate keys in array

From: Date: Fri, 23 Dec 2022 13:00:21 +0000
Subject: [php-src] Issue #10159: PHP silently merge the duplicate keys in array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243231@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10159 Author: foremtehan ### Description The following code: ```php <?php $array = [ 'a' => 1, 'a' => 2, 'a' => 3, ]; ``` Resulted in this output: ``` array(1) { ["a"]=> int(3) } ``` But I expected this output instead: ``` Error Exception ``` I open this ticket because i do think PHP should not allow duplicate key in the array, I was faced this issue when i was dynamically creating an array. ### PHP Version PHP All Versions ### Operating System All OSs

« previous php.bugs (#243231) next »