Annotation of embedaddon/php/ext/libxml/tests/bug54440.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #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: 
                      8: class TestWrapper {
                      9: 
                     10: function 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: 
                     17: function url_stat($path, $flags)
                     18: {
                     19: return array();
                     20: }
                     21: 
                     22: }
                     23: 
                     24: stream_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: 
                     30: stream_context_set_default(stream_context_get_options($ctx1));
                     31: @simplexml_load_file('test://sdfsdf');
                     32: 
                     33: libxml_set_streams_context($ctx2);
                     34: @simplexml_load_file('test://sdfsdf');
                     35: --EXPECT--
                     36: Array
                     37: (
                     38:     [test] => Array
                     39:         (
                     40:             [test] => test 1
                     41:         )
                     42: 
                     43: )
                     44: Array
                     45: (
                     46:     [test] => Array
                     47:         (
                     48:             [test] => test 2
                     49:         )
                     50: 
                     51: )

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>