1--TEST--
2Test incremental deflate_init() context reuse
3--EXTENSIONS--
4zlib
5--FILE--
6<?php
7$resource = deflate_init(ZLIB_ENCODING_DEFLATE);
8foreach (range("a", "z") as $char) {
9    deflate_add($resource, $char);
10}
11deflate_add($resource, "", ZLIB_FINISH);
12
13// Now reuse the existing resource after finishing the previous operations ...
14$uncompressed = $compressed = "";
15foreach (range("a", "z") as $char) {
16    $uncompressed .= $char;
17    $compressed .= deflate_add($resource, $char, ZLIB_NO_FLUSH);
18}
19$compressed .= deflate_add($resource, "", ZLIB_FINISH);
20assert($uncompressed === zlib_decode($compressed));
21?>
22===DONE===
23--EXPECT--
24===DONE===
25