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