Merge branch 'PHP-7.3'

* PHP-7.3:
  Fix #71592: External entity processing never fails
This commit is contained in:
Christoph M. Becker 2018-10-27 17:31:29 +02:00
commit c37beb7eb5
2 changed files with 34 additions and 1 deletions

View file

@ -359,7 +359,10 @@ _external_entity_ref_handler(void *user, const xmlChar *names, int type, const x
return;
}
parser->h_external_entity_ref(parser, names, (XML_Char *) "", sys_id, pub_id);
if (!parser->h_external_entity_ref(parser, names, (XML_Char *) "", sys_id, pub_id)) {
xmlStopParser(parser->parser);
parser->parser->errNo = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
};
}
static xmlEntityPtr

View file

@ -0,0 +1,30 @@
--TEST--
Bug #71592 (External entity processing never fails)
--SKIPIF--
<?php
if (!extension_loaded('xml')) die('skip xml extension not available');
?>
--FILE--
<?php
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE p [
<!ENTITY pic PUBLIC "image.gif" "http://example.org/image.gif">
]>
<root>
<p>&pic;</p>
<p></nop>
</root>
XML;
$parser = xml_parser_create_ns('UTF-8');
xml_set_external_entity_ref_handler($parser, function () {
return false;
});
xml_parse($parser, $xml);
var_dump(xml_get_error_code($parser));
?>
===DONE===
--EXPECT--
int(21)
===DONE===