004.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --TEST--
  2. libxml_set_streams_context()
  3. --SKIPIF--
  4. <?php if (!extension_loaded('dom')) die('skip'); ?>
  5. --FILE--
  6. <?php
  7. $ctxs = array(
  8. NULL,
  9. 'bogus',
  10. 123,
  11. new stdclass,
  12. array('a'),
  13. stream_context_create(),
  14. stream_context_create(array('file')),
  15. stream_context_create(array('file' => array('some_opt' => 'aaa')))
  16. );
  17. foreach ($ctxs as $ctx) {
  18. var_dump(libxml_set_streams_context($ctx));
  19. $dom = new DOMDocument();
  20. var_dump($dom->load(dirname(__FILE__).'/test.xml'));
  21. }
  22. echo "Done\n";
  23. ?>
  24. --EXPECTF--
  25. Warning: stream_context_create(): options should have the form ["wrappername"]["optionname"] = $value in %s004.php on line %d
  26. Warning: libxml_set_streams_context() expects parameter 1 to be resource, null given in %s004.php on line %d
  27. NULL
  28. bool(true)
  29. Warning: libxml_set_streams_context() expects parameter 1 to be resource, string given in %s004.php on line %d
  30. NULL
  31. bool(true)
  32. Warning: libxml_set_streams_context() expects parameter 1 to be resource, integer given in %s004.php on line %d
  33. NULL
  34. bool(true)
  35. Warning: libxml_set_streams_context() expects parameter 1 to be resource, object given in %s004.php on line %d
  36. NULL
  37. bool(true)
  38. Warning: libxml_set_streams_context() expects parameter 1 to be resource, array given in %s004.php on line %d
  39. NULL
  40. bool(true)
  41. NULL
  42. bool(true)
  43. NULL
  44. bool(true)
  45. NULL
  46. bool(true)
  47. Done