1--TEST--
2GH-15155: Stream context is lost when custom stream wrapper is being filtered
3--FILE--
4<?php
5
6class DummyWrapper
7{
8    public $context;
9
10    public function stream_open(string $path, string $mode, int $options, ?string &$opened_path): bool
11    {
12        $options = stream_context_get_options($this->context);
13        var_dump($options['dummy']['foo']);
14        return true;
15    }
16
17    public function stream_stat()
18    {
19    }
20
21    public function stream_read()
22    {
23    }
24
25    public function stream_eof()
26    {
27    }
28}
29
30$context = stream_context_create(['dummy' => ['foo' => 'bar']]);
31stream_wrapper_register('dummy', DummyWrapper::class);
32file_get_contents('dummy://foo', false, $context);
33@file_get_contents('php://filter/resource=dummy://foo', false, $context);
34?>
35--EXPECT--
36string(3) "bar"
37string(3) "bar"
38