forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvalue_errors_open.phpt
143 lines (131 loc) · 3.7 KB
/
value_errors_open.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
--TEST--
DBA argument tests
--EXTENSIONS--
dba
--CONFLICTS--
dba
--SKIPIF--
<?php
require_once(__DIR__ .'/skipif.inc');
die("info $HND handler used");
?>
--FILE--
<?php
require_once(__DIR__ .'/test.inc');
echo "database handler: $handler\n";
var_dump(dba_open($db_file, 'n'));
echo '=== Invalid arguments dba_open() ===', \PHP_EOL;
var_dump(dba_open($db_file, 'n', 'bogus'));
try {
var_dump(dba_open('', 'nq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, ''));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'nq', ''));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'q'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'nq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'rdq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'n-t'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'r', $handler, 0o644, -10));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
echo '=== Invalid arguments dba_popen() ===', \PHP_EOL;
var_dump(dba_popen($db_file, 'n', 'bogus'));
try {
var_dump(dba_popen('', 'nq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, ''));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'nq', ''));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'q'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'nq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'rdq'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'n-t'));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'r', $handler, 0o644, -10));
} catch (\ValueError $e) {
echo $e->getMessage(), \PHP_EOL;
}
?>
--CLEAN--
<?php
require(__DIR__ .'/clean.inc');
?>
--EXPECTF--
database handler: flatfile
object(Dba\Connection)#%d (%d) {
}
=== Invalid arguments dba_open() ===
Warning: dba_open(): Handler "bogus" is not available in %s on line %d
bool(false)
dba_open(): Argument #1 ($path) must not be empty
dba_open(): Argument #2 ($mode) must not be empty
dba_open(): Argument #3 ($handler) must not be empty
dba_open(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
dba_open(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
dba_open(): Argument #2 ($mode) third character must be "t"
dba_open(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
dba_open(): Argument #5 ($map_size) must be greater than or equal to 0
=== Invalid arguments dba_popen() ===
Warning: dba_popen(): Handler "bogus" is not available in %s on line %d
bool(false)
dba_popen(): Argument #1 ($path) must not be empty
dba_popen(): Argument #2 ($mode) must not be empty
dba_popen(): Argument #3 ($handler) must not be empty
dba_popen(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
dba_popen(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
dba_popen(): Argument #2 ($mode) third character must be "t"
dba_popen(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
dba_popen(): Argument #5 ($map_size) must be greater than or equal to 0