summaryrefslogtreecommitdiff
path: root/ext/libxml/tests/bug54440.phpt
blob: 4074ff9fe8405dbae053bca11b44f47d73c8a078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--TEST--
Bug #54440: libxml extension ignores default context
--SKIPIF--
<?php if (!extension_loaded('simplexml')) die('skip simplexml required for this test'); ?>
--FILE--
<?php

class TestWrapper {

function stream_open($path, $mode, $options, &$opened_path)
{
	if ($this->context)
		print_r(stream_context_get_options($this->context));
	return false;
}

function url_stat($path, $flags)
{
return array();
}

}

stream_wrapper_register("test", "TestWrapper")
    or die("Failed to register protocol");

$ctx1 = stream_context_create(array('test'=>array('test'=>'test 1')));
$ctx2 = stream_context_create(array('test'=>array('test'=>'test 2')));

stream_context_set_default(stream_context_get_options($ctx1));
@simplexml_load_file('test://sdfsdf');

libxml_set_streams_context($ctx2);
@simplexml_load_file('test://sdfsdf');
--EXPECT--
Array
(
    [test] => Array
        (
            [test] => test 1
        )

)
Array
(
    [test] => Array
        (
            [test] => test 2
        )

)