1--TEST--
2Test incremental inflate_init() context reuse
3--SKIPIF--
4<?php
5if (!extension_loaded("zlib")) {
6    print "skip - ZLIB extension not loaded";
7}
8?>
9--FILE--
10<?php
11$resource = inflate_init(ZLIB_ENCODING_GZIP);
12
13$uncompressed = implode(range("a","z"));
14$compressed = gzencode($uncompressed);
15$inflated = "";
16for ($i=0;$i<strlen($compressed);$i++) {
17    $inflated .= inflate_add($resource, $compressed[$i]);
18}
19$inflated .= inflate_add($resource, "", ZLIB_FINISH);
20assert($inflated === $uncompressed);
21
22// Now reuse the existing resource after finishing the previous operations ...
23$inflated = "";
24for ($i=0;$i<strlen($compressed);$i++) {
25    $inflated .= inflate_add($resource, $compressed[$i]);
26}
27$inflated .= inflate_add($resource, "", ZLIB_FINISH);
28assert($inflated === $uncompressed);
29?>
30===DONE===
31--EXPECT--
32===DONE===
33