mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
28 lines
749 B
PHP
28 lines
749 B
PHP
--TEST--
|
|
Test incremental inflate_init() context reuse
|
|
--EXTENSIONS--
|
|
zlib
|
|
--FILE--
|
|
<?php
|
|
$resource = inflate_init(ZLIB_ENCODING_GZIP);
|
|
|
|
$uncompressed = implode(range("a","z"));
|
|
$compressed = gzencode($uncompressed);
|
|
$inflated = "";
|
|
for ($i=0;$i<strlen($compressed);$i++) {
|
|
$inflated .= inflate_add($resource, $compressed[$i]);
|
|
}
|
|
$inflated .= inflate_add($resource, "", ZLIB_FINISH);
|
|
assert($inflated === $uncompressed);
|
|
|
|
// Now reuse the existing resource after finishing the previous operations ...
|
|
$inflated = "";
|
|
for ($i=0;$i<strlen($compressed);$i++) {
|
|
$inflated .= inflate_add($resource, $compressed[$i]);
|
|
}
|
|
$inflated .= inflate_add($resource, "", ZLIB_FINISH);
|
|
assert($inflated === $uncompressed);
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
===DONE===
|