File tree 3 files changed +40
-3
lines changed
3 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ static zend_string* php_dba_make_key(HashTable *key)
139
139
140
140
/* check whether the user has write access */
141
141
#define DBA_WRITE_CHECK (info ) \
142
- if((info)->mode != DBA_WRITER && (info)->mode != DBA_TRUNC && (info)->mode != DBA_CREAT) { \
143
- php_error_docref(NULL, E_WARNING, "You cannot perform a modification to a database without proper access "); \
142
+ if ((info)->mode != DBA_WRITER && (info)->mode != DBA_TRUNC && (info)->mode != DBA_CREAT) { \
143
+ php_error_docref(NULL, E_WARNING, "Cannot perform a modification on a readonly database "); \
144
144
RETURN_FALSE; \
145
145
}
146
146
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ Warning: dba_open(): Driver initialization failed for handler: cdb: Update opera
82
82
Failed to open DB
83
83
Test 2
84
84
85
- Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_cdb_001.php on line %d
85
+ Warning: dba_insert(): Cannot perform a modification on a readonly database in %sdba_cdb_001.php on line %d
86
86
Test 3
87
87
88
88
Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ DBA LMDB handler readonly test
3
+ --EXTENSIONS--
4
+ dba
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 );
17
+ assert ($ db_file !== false );
18
+ // Close handler
19
+ dba_close ($ db_file );
20
+
21
+ // Open in read only mode
22
+ $ db_file = dba_open ($ db_filename , "r " , $ handler );
23
+ assert ($ db_file !== false );
24
+
25
+ // Try inserting
26
+ dba_insert ("key1 " , "This is a test insert " , $ db_file );
27
+ dba_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--
37
+ Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d
You can’t perform that action at this time.
0 commit comments