bug54440.phpt 934 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Bug #54440: libxml extension ignores default context
  3. --EXTENSIONS--
  4. simplexml
  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. ?>
  28. --EXPECT--
  29. Array
  30. (
  31. [test] => Array
  32. (
  33. [test] => test 1
  34. )
  35. )
  36. Array
  37. (
  38. [test] => Array
  39. (
  40. [test] => test 2
  41. )
  42. )