1--TEST--
2Bug #46164 - 1 (stream_filter_remove() closes the stream)
3--FILE--
4<?php
5class user_filter extends php_user_filter {
6    function filter($in, $out, &$consumed, $closing) {
7        while($bucket = stream_bucket_make_writeable($in)) {
8            $consumed += $bucket->datalen;
9            stream_bucket_append($out, $bucket);
10        }
11        return PSFS_PASS_ON;
12    }
13}
14stream_filter_register('user_filter','user_filter');
15
16$fd = fopen('php://memory','w');
17$filter = stream_filter_append($fd, 'user_filter');
18stream_filter_remove($filter);
19var_dump(fclose($fd));
20?>
21--EXPECT--
22bool(true)
23