bug64230.phpt 938 B

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