1--TEST--
2DBA LMDB handler readonly test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7    $handler = 'lmdb';
8    require_once __DIR__ .'/skipif.inc';
9?>
10--FILE--
11<?php
12$handler = 'lmdb';
13$db_filename = __DIR__ . "/lmdb-readonly.dbm";
14
15// Create DB
16$db_file = dba_open($db_filename, "c", $handler);
17assert($db_file !== false);
18// Close handler
19dba_close($db_file);
20
21// Open in read only mode
22$db_file = dba_open($db_filename, "r", $handler);
23assert($db_file !== false);
24
25// Try inserting
26dba_insert("key1", "This is a test insert", $db_file);
27dba_close($db_file);
28?>
29--CLEAN--
30<?php
31$db_filename = __DIR__ . "/lmdb-readonly.dbm";
32@unlink($db_filename);
33@unlink($db_filename.'.lck');
34@unlink($db_filename.'-lock');
35?>
36--EXPECTF--
37Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d
38