xref: /PHP-8.3/ext/libxml/tests/bug54440.phpt (revision 74859783)
1--TEST--
2Bug #54440: libxml extension ignores default context
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8class TestWrapper {
9
10function stream_open($path, $mode, $options, &$opened_path)
11{
12    if ($this->context)
13        print_r(stream_context_get_options($this->context));
14    return false;
15}
16
17function url_stat($path, $flags)
18{
19return array();
20}
21
22}
23
24stream_wrapper_register("test", "TestWrapper")
25    or die("Failed to register protocol");
26
27$ctx1 = stream_context_create(array('test'=>array('test'=>'test 1')));
28$ctx2 = stream_context_create(array('test'=>array('test'=>'test 2')));
29
30stream_context_set_default(stream_context_get_options($ctx1));
31@simplexml_load_file('test://sdfsdf');
32
33libxml_set_streams_context($ctx2);
34@simplexml_load_file('test://sdfsdf');
35?>
36--EXPECT--
37Array
38(
39    [test] => Array
40        (
41            [test] => test 1
42        )
43
44)
45Array
46(
47    [test] => Array
48        (
49            [test] => test 2
50        )
51
52)
53