[php-src] Issue #11451: Invalid associative array containing duplicate keys

From: Date: Wed, 14 Jun 2023 16:58:58 +0000
Subject: [php-src] Issue #11451: Invalid associative array containing duplicate keys
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244692@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11451 Author: t-voet ### Description The following code: ```php <?php var_dump((new SQLite3(':memory:')) ->query('SELECT 1 AS key,2 AS key') ->fetchArray(SQLITE3_ASSOC)); ``` Resulted in this output, for PHP 8.2.*: ``` array(2) { ["key"]=> int(1) ["key"]=> int(2) } ``` But I expected this output instead, like PHP 8.1.20 and earlier: ``` array(1) { ["key"]=> int(2) } ``` These duplicate keys are propagated by json_encode(), serialize(), ... resulting in invalid JSON, for example. ### PHP Version PHP 8.2.7 ### Operating System FreeBSD 13.1-RELEASE-p6

« previous php.bugs (#244692) next »