dba_insert() for ini files can result in duplicate keys
Offen
@Girgias arbeitet bereits daran.
Seit 21.3.2023.
Bug
Extension: dba
Status: Verified
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
Description
The following code:
<?php
@unlink("test.ini");
touch("test.ini");
$db = dba_open("test.ini", "wl", "inifile");
var_dump($db);
var_dump(dba_fetch("nonexisting", $db));
var_dump(dba_insert("nonexisting", "newvalue", $db));
var_dump(dba_insert("nonexisting", "newvalue", $db));
dba_close($db);
Resulted in this output:
resource(7) of type (dba)
bool(false)
bool(true)
bool(true)
But I expected this output instead:
resource(7) of type (dba)
bool(false)
bool(true)
bool(false)
And additionally: not an extra same-key entry in my ini file.
Because according to the docs at https://www.php.net/manual/en/function.dba-insert.php:
If this key already exist in the database, this function will fail.
PHP Version
PHP 8.1+
Operating System
Linux 6.2.x
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.