xref: /PHP-8.2/ext/xml/tests/bug30875.phpt (revision 74859783)
1--TEST--
2Bug #30875 (xml_parse_into_struct() does not resolve entities)
3--EXTENSIONS--
4xml
5--FILE--
6<?php
7
8$xml = <<<XML
9<!DOCTYPE dtd [
10    <!ENTITY ref "ent">
11]>
12<elt att="&ref;">a&ref;</elt>
13XML;
14
15$parser = xml_parser_create();
16xml_parse_into_struct($parser, $xml, $vals);
17xml_parser_free($parser);
18var_dump($vals);
19?>
20--EXPECT--
21array(1) {
22  [0]=>
23  array(5) {
24    ["tag"]=>
25    string(3) "ELT"
26    ["type"]=>
27    string(8) "complete"
28    ["level"]=>
29    int(1)
30    ["attributes"]=>
31    array(1) {
32      ["ATT"]=>
33      string(3) "ent"
34    }
35    ["value"]=>
36    string(4) "aent"
37  }
38}
39