1--TEST--
2Test deflate_init() error
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7
8try {
9    var_dump(deflate_init(42));
10} catch (\ValueError $e) {
11    echo $e->getMessage() . \PHP_EOL;
12}
13
14try {
15    var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => 42]));
16} catch (\ValueError $e) {
17    echo $e->getMessage() . \PHP_EOL;
18}
19
20try {
21    var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['level' => -2]));
22} catch (\ValueError $e) {
23    echo $e->getMessage() . \PHP_EOL;
24}
25
26try {
27    var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 0]));
28} catch (\ValueError $e) {
29    echo $e->getMessage() . \PHP_EOL;
30}
31
32try {
33    var_dump(deflate_init(ZLIB_ENCODING_DEFLATE, ['memory' => 10]));
34} catch (\ValueError $e) {
35    echo $e->getMessage() . \PHP_EOL;
36}
37
38?>
39--EXPECT--
40deflate_init(): Argument #1 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
41deflate_init(): "level" option must be between -1 and 9
42deflate_init(): "level" option must be between -1 and 9
43deflate_init(): "memory" option must be between 1 and 9
44deflate_init(): "memory" option must be between 1 and 9
45