From 5c052b76fd9870a1642f0215c7555081aebb1820 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 13 Aug 2024 00:59:35 -0500 Subject: user/php7: Revbump for ICU 75 rebuild, libxml2 fix --- user/php7/gh14834.patch | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 user/php7/gh14834.patch (limited to 'user/php7/gh14834.patch') diff --git a/user/php7/gh14834.patch b/user/php7/gh14834.patch new file mode 100644 index 000000000..258b5e8f9 --- /dev/null +++ b/user/php7/gh14834.patch @@ -0,0 +1,62 @@ +From dc2ce0df9be530e7ee91b0dfa6eb6ce2d5e5baad Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Fri, 5 Jul 2024 23:34:09 +0200 +Subject: [PATCH] Fix GH-14834: Error installing PHP when --with-pear is used + +libxml2 2.13 makes changes to how the parsing state is set, update our +code accordingly. In particular, it started reporting entities within +attributes, while it should only report entities inside text nodes. +--- + ext/xml/compat.c | 2 +- + ext/xml/tests/gh14834.phpt | 29 +++++++++++++++++++++++++++++ + 2 files changed, 30 insertions(+), 1 deletion(-) + create mode 100644 ext/xml/tests/gh14834.phpt + +diff --git a/ext/xml/compat.c b/ext/xml/compat.c +index 7b463ebb5112e..7ca015acc5421 100644 +--- a/ext/xml/compat.c ++++ b/ext/xml/compat.c +@@ -376,7 +376,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 0000000000000..2781ba2ed0941 +--- /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) " ++" -- cgit v1.2.3-70-g09d2