xref: /PHP-8.0/ext/bz2/tests/bug75776.phpt (revision 963e50c8)
1--TEST--
2Bug #75776 (Flushing streams with compression filter is broken)
3--SKIPIF--
4<?php
5if (!extension_loaded('bz2')) die('skip bz2 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, 'bzip2.compress', 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(144) "425a68343141592653599fe7bbbf0001f389007fe03f002000902980026826aa80003ea9061520c6a41954833a9069520d6a41b54837a9071520e6a41d5483ba9079520f6a41f548"
24int(72)
25