xref: /PHP-8.1/ext/dba/tests/dba014.phpt (revision b5a14e6c)
1--TEST--
2DBA with array key with array containing too many elements
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7require_once(__DIR__ .'/skipif.inc');
8die("info $HND handler used");
9?>
10--FILE--
11<?php
12require_once(__DIR__ .'/test.inc');
13echo "database handler: $handler\n";
14
15if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
16    dba_insert(array("a", "b", "c"), "Content String 2", $db_file);
17} else {
18    echo "Error creating database\n";
19}
20
21?>
22--CLEAN--
23<?php
24require(__DIR__ .'/clean.inc');
25?>
26--EXPECTF--
27database handler: %s
28
29Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" in %s.php:%d
30Stack trace:
31#0 %sdba014.php(6): dba_insert(Array, '%s', Resource id #%d)
32#1 {main}
33  thrown in %sdba014.php on line 6
34