summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-10-09 16:08:28 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-10-09 16:08:55 +0200
commit54e152cb92d86d32b0474b11f380c621ff0c03ea (patch)
treed6c98ee40a2e65302c773fde59d985dac56a20e5 /ext
parentefb9ccc91bfe182c4e76a0badee9d5fcb11735d5 (diff)
parentebecf569f98b83bcd0fab20418a5983e6f14d39e (diff)
downloadphp-git-54e152cb92d86d32b0474b11f380c621ff0c03ea.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #30875: xml_parse_into_struct() does not resolve entities
Diffstat (limited to 'ext')
-rw-r--r--ext/xml/tests/bug30875.phpt42
-rw-r--r--ext/xml/xml.c1
2 files changed, 42 insertions, 1 deletions
diff --git a/ext/xml/tests/bug30875.phpt b/ext/xml/tests/bug30875.phpt
new file mode 100644
index 0000000000..c5254e9668
--- /dev/null
+++ b/ext/xml/tests/bug30875.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Bug #30875 (xml_parse_into_struct() does not resolve entities)
+--SKIPIF--
+<?php
+if (!extension_loaded('xml')) die('skip xml extension not available');
+?>
+--FILE--
+<?php
+
+$xml = <<<XML
+<!DOCTYPE dtd [
+ <!ENTITY ref "ent">
+]>
+<elt att="&ref;">a&ref;</elt>
+XML;
+
+$parser = xml_parser_create();
+xml_parse_into_struct($parser, $xml, $vals);
+xml_parser_free($parser);
+var_dump($vals);
+?>
+===DONE===
+--EXPECT--
+array(1) {
+ [0]=>
+ array(5) {
+ ["tag"]=>
+ string(3) "ELT"
+ ["type"]=>
+ string(8) "complete"
+ ["level"]=>
+ int(1)
+ ["attributes"]=>
+ array(1) {
+ ["ATT"]=>
+ string(3) "ent"
+ }
+ ["value"]=>
+ string(4) "aent"
+ }
+}
+===DONE===
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 35a1b2984e..3cacb31ad7 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -1434,7 +1434,6 @@ PHP_FUNCTION(xml_parse_into_struct)
parser->level = 0;
parser->ltags = safe_emalloc(XML_MAXLEVEL, sizeof(char *), 0);
- XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
XML_SetElementHandler(parser->parser, _xml_startElementHandler, _xml_endElementHandler);
XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);