xref: /PHP-5.4/ext/libxml/tests/bug54440.phpt (revision 047ed8df)
1--TEST--
2Bug #54440: libxml extension ignores default context
3--SKIPIF--
4<?php if (!extension_loaded('simplexml')) die('skip simplexml required for this test'); ?>
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--EXPECT--
36Array
37(
38    [test] => Array
39        (
40            [test] => test 1
41        )
42
43)
44Array
45(
46    [test] => Array
47        (
48            [test] => test 2
49        )
50
51)
52