1--TEST--
2Bug #73586 (php_user_filter::$stream is not set to the stream the filter is working on).
3--FILE--
4<?php
5class append_filter extends php_user_filter {
6    public $stream;
7    function filter($in, $out, &$consumed, $closing): int {
8        while ($bucket = stream_bucket_make_writeable($in)) {
9            $consumed += $bucket->datalen;
10            stream_bucket_append($out, $bucket);
11        }
12        if ($closing) {
13            $bucket = stream_bucket_new($this->stream, "FooBar\n");
14            stream_bucket_append($out, $bucket);
15        }
16        return PSFS_PASS_ON;
17    }
18}
19stream_filter_register("append", "append_filter");
20$fin = fopen(__FILE__, 'rb');
21stream_filter_append($fin, 'append', STREAM_FILTER_READ);
22stream_copy_to_stream($fin, STDOUT);
23?>
24--EXPECT--
25<?php
26class append_filter extends php_user_filter {
27    public $stream;
28    function filter($in, $out, &$consumed, $closing): int {
29        while ($bucket = stream_bucket_make_writeable($in)) {
30            $consumed += $bucket->datalen;
31            stream_bucket_append($out, $bucket);
32        }
33        if ($closing) {
34            $bucket = stream_bucket_new($this->stream, "FooBar\n");
35            stream_bucket_append($out, $bucket);
36        }
37        return PSFS_PASS_ON;
38    }
39}
40stream_filter_register("append", "append_filter");
41$fin = fopen(__FILE__, 'rb');
42stream_filter_append($fin, 'append', STREAM_FILTER_READ);
43stream_copy_to_stream($fin, STDOUT);
44?>
45FooBar
46