xref: /PHP-8.1/ext/dba/tests/dba_db4_013.phpt (revision b5a14e6c)
1--TEST--
2DBA DB4 File open("rl") & Insert Test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7$handler = "db4";
8require_once(__DIR__ .'/skipif.inc');
9die("info $HND handler used");
10?>
11--FILE--
12<?php
13
14$handler = "db4";
15require_once(__DIR__ .'/test.inc');
16echo "database handler: $handler\n";
17
18if (($db_file = dba_popen($db_filename, "c", $handler)) !== FALSE) {
19    echo "database file created\n";
20    dba_close($db_file);
21}
22
23if (($db_file = dba_popen($db_filename, "rl", $handler)) !== FALSE) {
24    echo "database file opened\n";
25    dba_insert("key1", "This is a test insert", $db_file);
26    echo dba_fetch("key1", $db_file), "\n";
27    dba_close($db_file);
28} else {
29    echo "Error creating $db_filename\n";
30}
31
32?>
33--CLEAN--
34<?php
35require(__DIR__ .'/clean.inc');
36?>
37--EXPECTF--
38database handler: db4
39database file created
40database file opened
41
42Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_db4_013.php on line %d
43