From a0c6dff11c151d72f6794b51eab5fbd5aa691dd2 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Fri, 29 Sep 2023 23:35:22 +0200 Subject: [PATCH] Fix compile error with -Werror=incompatible-function-pointer-types and old libxml2 libxml2 prior to 2.9.8 had a different signature for xmlHashScanner. This signature changed in https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787 Use an #if to work around the incompatible signature. --- ext/dom/dom_iterators.c | 1 + ext/libxml/libxml.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 2614eff85a03..21d59c5f02b9 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -38,6 +38,7 @@ struct _notationIterator { xmlNotation *notation; }; +/* Function pointer typedef changed in 2.9.8, see https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787 */ #if LIBXML_VERSION >= 20908 static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */ #else diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 6b9cd64c299d..48b981a95a5c 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -136,7 +136,12 @@ PHP_LIBXML_API void php_libxml_set_old_ns(xmlDocPtr doc, xmlNsPtr ns) php_libxml_set_old_ns_list(doc, ns, ns); } +/* Function pointer typedef changed in 2.9.8, see https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787 */ +#if LIBXML_VERSION >= 20908 static void php_libxml_unlink_entity(void *data, void *table, const xmlChar *name) +#else +static void php_libxml_unlink_entity(void *data, void *table, xmlChar *name) +#endif { xmlEntityPtr entity = data; if (entity->_private != NULL) {