summaryrefslogtreecommitdiff
path: root/ext/xmlreader/tests/bug64230.phpt
blob: b584d8f7cf435aaac4942cd845b200f845e0dec6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--TEST--
Bug #64230 (XMLReader does not suppress errors)
--SKIPIF--
<?php
extension_loaded("xmlreader") or die("skip requires xmlreader");
?>
--FILE--
<?php
echo "Test\n";

function show_internal_errors() {
    foreach (libxml_get_errors() as $error) {
        printf("Internal: %s\n", $error->message);
    }
    libxml_clear_errors();
}

echo "Internal errors TRUE\n";
libxml_use_internal_errors(true);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

echo "Internal errors FALSE\n";
libxml_use_internal_errors(false);

$x = new XMLReader;
$x->xml("<root att/>");
$x->read();

show_internal_errors();

?>
Done
--EXPECTF--
Test
Internal errors TRUE
Internal: Specification mandate%A value for attribute att

Internal errors FALSE

Warning: XMLReader::read(): %s: parser error : Specification mandate%A value for attribute att in %s on line %d

Warning: XMLReader::read(): <root att/> in %s on line %d

Warning: XMLReader::read():          ^ in %s on line %d
Done