forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeflate_init_error.phpt
44 lines (38 loc) · 1.08 KB
/
deflate_init_error.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
--TEST--
Test deflate_init() error
--EXTENSIONS--
zlib
--FILE--
<?php
try {
var_dump(deflate_init(42));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42]));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2]));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0]));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10]));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
deflate_init(): "level" option must be between -1 and 9
deflate_init(): "level" option must be between -1 and 9
deflate_init(): "memory" option must be between 1 and 9
deflate_init(): "memory" option must be between 1 and 9