Merge branch 'PHP-8.3'

* PHP-8.3:
  Fix GH-14834: Error installing PHP when --with-pear is used
This commit is contained in:
Niels Dossche 2024-07-06 13:52:42 +02:00
commit f98aa06c68
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 30 additions and 1 deletions

View file

@ -355,7 +355,7 @@ _get_entity(void *user, const xmlChar *name)
if (ret == NULL)
ret = xmlGetDocEntity(parser->parser->myDoc, name);
if (ret == NULL || (parser->parser->instate != XML_PARSER_ENTITY_VALUE && parser->parser->instate != XML_PARSER_ATTRIBUTE_VALUE)) {
if (ret == NULL || parser->parser->instate == XML_PARSER_CONTENT) {
if (ret == NULL || ret->etype == XML_INTERNAL_GENERAL_ENTITY || ret->etype == XML_INTERNAL_PARAMETER_ENTITY || ret->etype == XML_INTERNAL_PREDEFINED_ENTITY) {
/* Predefined entities will expand unless no cdata handler is present */
if (parser->h_default && ! (ret && ret->etype == XML_INTERNAL_PREDEFINED_ENTITY && parser->h_cdata)) {

View file

@ -0,0 +1,29 @@
--TEST--
GH-14834 (Error installing PHP when --with-pear is used)
--EXTENSIONS--
xml
--FILE--
<?php
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE root [
<!ENTITY foo "ent">
]>
<root>
<element hint="hello&apos;world">&foo;<![CDATA[ &amp; ]]><?x &amp; ?></element>
</root>
XML;
$parser = xml_parser_create();
xml_set_character_data_handler($parser, function($_, $data) {
var_dump($data);
});
xml_parse($parser, $xml, true);
?>
--EXPECT--
string(3) "
"
string(3) "ent"
string(7) " &amp; "
string(1) "
"