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 e03f0a199a
Use an #if to work around the incompatible signature.

Closes GH-12326.
This commit is contained in:
Niels Dossche 2023-09-29 23:35:22 +02:00
parent fa2d556fcd
commit df89409aba
3 changed files with 10 additions and 0 deletions

4
NEWS
View file

@ -13,6 +13,10 @@ PHP NEWS
- DOM: - DOM:
. Restore old namespace reconciliation behaviour. (nielsdos) . Restore old namespace reconciliation behaviour. (nielsdos)
- LibXML:
. Fix compile error with -Werror=incompatible-function-pointer-types and
old libxml2. (nielsdos)
- MySQLnd: - MySQLnd:
. Fixed bug GH-12297 (PHP Startup: Invalid library (maybe not a PHP library) . Fixed bug GH-12297 (PHP Startup: Invalid library (maybe not a PHP library)
'mysqlnd.so' in Unknown on line). (nielsdos) 'mysqlnd.so' in Unknown on line). (nielsdos)

View file

@ -38,6 +38,7 @@ struct _notationIterator {
xmlNotation *notation; xmlNotation *notation;
}; };
/* Function pointer typedef changed in 2.9.8, see https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787 */
#if LIBXML_VERSION >= 20908 #if LIBXML_VERSION >= 20908
static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */ static void itemHashScanner (void *payload, void *data, const xmlChar *name) /* {{{ */
#else #else

View file

@ -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); 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) 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; xmlEntityPtr entity = data;
if (entity->_private != NULL) { if (entity->_private != NULL) {