Fix libxml2 2.12.x build issues. https://github.com/php/php-src/commit/8a95e616b91ac0eeedba90a61e36e652919763f2 https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -23,6 +23,7 @@ #if defined(HAVE_LIBXML) && defined(HAVE_DOM) #include "php_dom.h" #include +#include #ifdef LIBXML_SCHEMAS_ENABLED #include #include --- a/ext/libxml/libxml.c 2023-08-03 12:13:08.000000000 -0500 +++ b/ext/libxml/libxml.c 2024-05-17 08:58:49.000000000 -0500 @@ -481,7 +481,11 @@ xmlResetError((xmlErrorPtr) ptr); } -static void _php_list_set_error_structure(xmlErrorPtr error, const char *msg) +#if LIBXML_VERSION >= 21200 +static void _php_list_set_error_structure(const xmlError *error, const char *msg) +#else +static void _php_list_set_error_structure(xmlError *error, const char *msg) +#endif { xmlError error_copy; int ret; @@ -732,7 +736,11 @@ va_end(args); } +#if LIBXML_VERSION >= 21200 +PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, const xmlError *error) +#else PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, xmlErrorPtr error) +#endif { _php_list_set_error_structure(error, NULL); @@ -1035,11 +1043,9 @@ /* {{{ Retrieve last error from libxml */ PHP_FUNCTION(libxml_get_last_error) { - xmlErrorPtr error; - ZEND_PARSE_PARAMETERS_NONE(); - error = xmlGetLastError(); + const xmlError *error = xmlGetLastError(); if (error) { object_init_ex(return_value, libxmlerror_class_entry); --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -35,6 +35,7 @@ extern zend_module_entry libxml_module_entry; #include "zend_smart_str.h" #include +#include #define LIBXML_SAVE_NOEMPTYTAG 1<<2