Merge branch 'PHP-7.2' into PHP-7.3

* PHP-7.2:
  Fix #30875: xml_parse_into_struct() does not resolve entities
This commit is contained in:
Christoph M. Becker 2018-10-09 16:08:28 +02:00
commit 54e152cb92
3 changed files with 45 additions and 1 deletions

3
NEWS
View File

@ -6,6 +6,9 @@ PHP NEWS
. Fixed bug #75577 (DateTime::createFromFormat does not accept 'v' format
specifier, by updating timelib to 2018.01alpha2). (Derick)
- XML:
. Fixed bug #30875 (xml_parse_into_struct() does not resolve entities). (cmb)
11 Oct 2018, PHP 7.3.0RC3
- CURL:

View File

@ -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===

View File

@ -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);