1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Files
archived-php-src/ext/bz2/tests/bug81092.phpt
T
Christoph M. Becker 64865c6092 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #81092: fflush before stream_filter_remove corrupts stream
2021-06-08 15:41:09 +02:00

21 lines
502 B
PHP

--TEST--
Bug #81092 (fflush before stream_filter_remove corrupts stream)
--EXTENSIONS--
bz2
--FILE--
<?php
$stream = fopen(__DIR__ . "/81092.bz2", 'wb+');
$filter = stream_filter_append($stream, 'bzip2.compress', STREAM_FILTER_WRITE, ['blocks' => 9, 'work' => 0]);
fwrite($stream, random_bytes(8192));
fflush($stream);
stream_filter_remove($filter);
var_dump(strlen(bzdecompress(file_get_contents(__DIR__ . "/81092.bz2"))));
?>
--CLEAN--
<?php
@unlink(__DIR__ . "/81092.bz2");
?>
--EXPECT--
int(8192)