mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
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:
commit
54e152cb92
3
NEWS
3
NEWS
@ -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:
|
||||
|
42
ext/xml/tests/bug30875.phpt
Normal file
42
ext/xml/tests/bug30875.phpt
Normal 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===
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user