diff --git a/NEWS b/NEWS index 25ec4b80c80..18c93b5627e 100644 --- a/NEWS +++ b/NEWS @@ -46,6 +46,8 @@ PHP NEWS - XML: . Move away from to-be-deprecated libxml fields. (nielsdos) + . Fixed bug GH-14834 (Error installing PHP when --with-pear is used). + (nielsdos) 20 Jun 2024, PHP 8.3.9 diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 242cc4ba7c4..5f55dc62b36 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -375,7 +375,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)) { diff --git a/ext/xml/tests/gh14834.phpt b/ext/xml/tests/gh14834.phpt new file mode 100644 index 00000000000..2781ba2ed09 --- /dev/null +++ b/ext/xml/tests/gh14834.phpt @@ -0,0 +1,29 @@ +--TEST-- +GH-14834 (Error installing PHP when --with-pear is used) +--EXTENSIONS-- +xml +--FILE-- + + +]> + + &foo; + +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) " & " +string(1) " +"