Merge branch 'PHP-8.2' into PHP-8.3

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

2
NEWS
View file

@ -46,6 +46,8 @@ PHP NEWS
- XML: - XML:
. Move away from to-be-deprecated libxml fields. (nielsdos) . 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 20 Jun 2024, PHP 8.3.9

View file

@ -375,7 +375,7 @@ _get_entity(void *user, const xmlChar *name)
if (ret == NULL) if (ret == NULL)
ret = xmlGetDocEntity(parser->parser->myDoc, name); 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) { 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 */ /* Predefined entities will expand unless no cdata handler is present */
if (parser->h_default && ! (ret && ret->etype == XML_INTERNAL_PREDEFINED_ENTITY && parser->h_cdata)) { 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) "
"