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