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