xref: /PHP-8.0/ext/zlib/tests/bug48725.phpt (revision 20e75329)
1--TEST--
2Bug #48725 (Support for flushing in zlib stream)
3--SKIPIF--
4<?php
5if (!extension_loaded('zlib')) die('skip zip extension not available');
6?>
7--FILE--
8<?php
9$text = str_repeat('0123456789abcdef', 1000);
10
11$temp = fopen('php://temp', 'r+');
12stream_filter_append($temp, 'zlib.deflate', STREAM_FILTER_WRITE);
13fwrite($temp, $text);
14
15rewind($temp);
16
17var_dump(bin2hex(stream_get_contents($temp)));
18var_dump(ftell($temp));
19
20fclose($temp);
21?>
22--EXPECT--
23string(138) "ecc7c901c0100000b09594bac641d97f840e22f9253c31bdb9d4d6c75cdf3ec1ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddaffc0f0000ffff"
24int(69)
25