1--TEST--
2Bug #75776 (Flushing streams with compression filter is broken)
3--EXTENSIONS--
4zlib
5bz2
6--FILE--
7<?php
8$compression = [
9    'gz' => ['zlib.deflate', 'gzinflate'],
10    'bz2' => ['bzip2.compress', 'bzdecompress']
11];
12foreach ($compression as $ext => [$filter, $function]) {
13    $stream = fopen(__DIR__ . "/75776.$ext", 'w');
14    stream_filter_append($stream, $filter);
15    fwrite($stream,"sdfgdfg");
16    fflush($stream);
17    fclose($stream);
18
19    $compressed = file_get_contents(__DIR__ . "/75776.$ext");
20    var_dump($function($compressed));
21}
22?>
23--EXPECT--
24string(7) "sdfgdfg"
25string(7) "sdfgdfg"
26--CLEAN--
27<?php
28@unlink(__DIR__ . "/75776.gz");
29@unlink(__DIR__ . "/75776.bz2");
30?>
31