004.phpt 989 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. libxml_set_streams_context()
  3. --EXTENSIONS--
  4. dom
  5. --FILE--
  6. <?php
  7. $ctxs = array(
  8. NULL,
  9. 'bogus',
  10. 123,
  11. new stdclass,
  12. array('a'),
  13. stream_context_create(),
  14. );
  15. foreach ($ctxs as $ctx) {
  16. try {
  17. var_dump(libxml_set_streams_context($ctx));
  18. } catch (TypeError $e) {
  19. echo $e->getMessage(), "\n";
  20. }
  21. $dom = new DOMDocument();
  22. var_dump($dom->load(__DIR__.'/test.xml'));
  23. }
  24. echo "Done\n";
  25. ?>
  26. --EXPECT--
  27. libxml_set_streams_context(): Argument #1 ($context) must be of type resource, null given
  28. bool(true)
  29. libxml_set_streams_context(): Argument #1 ($context) must be of type resource, string given
  30. bool(true)
  31. libxml_set_streams_context(): Argument #1 ($context) must be of type resource, int given
  32. bool(true)
  33. libxml_set_streams_context(): Argument #1 ($context) must be of type resource, stdClass given
  34. bool(true)
  35. libxml_set_streams_context(): Argument #1 ($context) must be of type resource, array given
  36. bool(true)
  37. NULL
  38. bool(true)
  39. Done