summaryrefslogtreecommitdiff
path: root/user/php7/gh14834.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2024-08-13 00:59:35 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2024-11-24 22:58:37 -0600
commit5c052b76fd9870a1642f0215c7555081aebb1820 (patch)
treeefffe4933a04208adacfbd31669099ae4e4139e9 /user/php7/gh14834.patch
parentf19ad2b2a9518b1aa8d22267ec80f6388da7f2d5 (diff)
downloadpackages-5c052b76fd9870a1642f0215c7555081aebb1820.tar.gz
packages-5c052b76fd9870a1642f0215c7555081aebb1820.tar.bz2
packages-5c052b76fd9870a1642f0215c7555081aebb1820.tar.xz
packages-5c052b76fd9870a1642f0215c7555081aebb1820.zip
user/php7: Revbump for ICU 75 rebuild, libxml2 fix
Diffstat (limited to 'user/php7/gh14834.patch')
-rw-r--r--user/php7/gh14834.patch62
1 files changed, 62 insertions, 0 deletions
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--
++<?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) "
++"