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