1--TEST--
2Test incremental deflate_add() error functionality
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7$badResource = fopen("php://memory", "r+");
8
9try {
10    var_dump(deflate_add($badResource, "test"));
11} catch (\TypeError $e) {
12    echo $e->getMessage() . \PHP_EOL;
13}
14
15$resource = deflate_init(ZLIB_ENCODING_DEFLATE);
16$badFlushType = 6789;
17
18try {
19    var_dump(deflate_add($resource, "test", $badFlushType));
20} catch (\ValueError $e) {
21    echo $e->getMessage() . \PHP_EOL;
22}
23
24?>
25--EXPECT--
26deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
27deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
28