bug64230.phpt 979 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --TEST--
  2. Bug #64230 (XMLReader does not suppress errors)
  3. --SKIPIF--
  4. <?php
  5. extension_loaded("xmlreader") or die("skip requires xmlreader");
  6. ?>
  7. --FILE--
  8. <?php
  9. echo "Test\n";
  10. function show_internal_errors() {
  11. foreach (libxml_get_errors() as $error) {
  12. printf("Internal: %s\n", $error->message);
  13. }
  14. libxml_clear_errors();
  15. }
  16. echo "Internal errors TRUE\n";
  17. libxml_use_internal_errors(true);
  18. $x = new XMLReader;
  19. $x->xml("<root att/>");
  20. $x->read();
  21. show_internal_errors();
  22. echo "Internal errors FALSE\n";
  23. libxml_use_internal_errors(false);
  24. $x = new XMLReader;
  25. $x->xml("<root att/>");
  26. $x->read();
  27. show_internal_errors();
  28. ?>
  29. Done
  30. --EXPECTF--
  31. Test
  32. Internal errors TRUE
  33. Internal: Specification mandate value for attribute att
  34. Internal errors FALSE
  35. Warning: XMLReader::read(): %s: parser error : Specification mandate value for attribute att in %s on line %d
  36. Warning: XMLReader::read(): <root att/> in %s on line %d
  37. Warning: XMLReader::read(): ^ in %s on line %d
  38. Done