bug54440.phpt 996 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. class TestWrapper {
  8. function stream_open($path, $mode, $options, &$opened_path)
  9. {
  10. if ($this->context)
  11. print_r(stream_context_get_options($this->context));
  12. return false;
  13. }
  14. function url_stat($path, $flags)
  15. {
  16. return array();
  17. }
  18. }
  19. stream_wrapper_register("test", "TestWrapper")
  20. or die("Failed to register protocol");
  21. $ctx1 = stream_context_create(array('test'=>array('test'=>'test 1')));
  22. $ctx2 = stream_context_create(array('test'=>array('test'=>'test 2')));
  23. stream_context_set_default(stream_context_get_options($ctx1));
  24. @simplexml_load_file('test://sdfsdf');
  25. libxml_set_streams_context($ctx2);
  26. @simplexml_load_file('test://sdfsdf');
  27. --EXPECT--
  28. Array
  29. (
  30. [test] => Array
  31. (
  32. [test] => test 1
  33. )
  34. )
  35. Array
  36. (
  37. [test] => Array
  38. (
  39. [test] => test 2
  40. )
  41. )