xref: /PHP-7.1/ext/xml/tests/bug30875.phpt (revision 2845f859)
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===DONE===
23--EXPECT--
24array(1) {
25  [0]=>
26  array(5) {
27    ["tag"]=>
28    string(3) "ELT"
29    ["type"]=>
30    string(8) "complete"
31    ["level"]=>
32    int(1)
33    ["attributes"]=>
34    array(1) {
35      ["ATT"]=>
36      string(3) "ent"
37    }
38    ["value"]=>
39    string(4) "aent"
40  }
41}
42===DONE===
43