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