php-src/ext/sqlite3/tests/gh11451.phpt
nielsdos 29a96e09b2 Fix GH-11451: Invalid associative array containing duplicate keys
It used the "add_new" variant which assumes the key doesn't already
exist. But in case of duplicate keys we have to take the last result.

Closes GH-11453.
2023-06-15 21:56:06 +02:00

26 lines
436 B
PHP

--TEST--
GH-11451 (Invalid associative array containing duplicate keys)
--EXTENSIONS--
sqlite3
--FILE--
<?php
var_dump((new SQLite3(':memory:'))
->query('SELECT 1 AS key, 2 AS key')
->fetchArray(SQLITE3_ASSOC));
var_dump((new SQLite3(':memory:'))
->query('SELECT 0 AS dummy, 1 AS key, 2 AS key')
->fetchArray(SQLITE3_ASSOC));
?>
--EXPECT--
array(1) {
["key"]=>
int(2)
}
array(2) {
["dummy"]=>
int(0)
["key"]=>
int(2)
}