1--TEST--
2Test incremental inflate_add() error functionality
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6    print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11
12$badResource = fopen("php://memory", "r+");
13try {
14    var_dump(inflate_add($badResource, "test"));
15} catch (\TypeError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18
19$resource = inflate_init(ZLIB_ENCODING_DEFLATE);
20$badFlushType = 6789;
21try {
22    var_dump(inflate_add($resource, "test", $badFlushType));
23} catch (\ValueError $e) {
24    echo $e->getMessage() . \PHP_EOL;
25}
26
27?>
28--EXPECT--
29inflate_add(): Argument #1 ($context) must be of type InflateContext, resource given
30inflate_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
31