Skip to content

Commit dfed528

Browse files
nielsdosremicollet
authored andcommitted
Backport 0a39890c: Fix libxml2 2.12 build due to API breaks
See https://github.com/php/php-src/actions/runs/7062192818/job/19225478601 (cherry picked from commit fa6a0f80f644932506666beb7c85e4041c4a4646)
1 parent 896f715 commit dfed528

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ext/libxml/libxml.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,11 @@ static void _php_libxml_free_error(void *ptr)
481481
xmlResetError((xmlErrorPtr) ptr);
482482
}
483483

484-
static void _php_list_set_error_structure(xmlErrorPtr error, const char *msg)
484+
#if LIBXML_VERSION >= 21200
485+
static void _php_list_set_error_structure(const xmlError *error, const char *msg)
486+
#else
487+
static void _php_list_set_error_structure(xmlError *error, const char *msg)
488+
#endif
485489
{
486490
xmlError error_copy;
487491
int ret;
@@ -734,7 +738,11 @@ PHP_LIBXML_API void php_libxml_ctx_warning(void *ctx, const char *msg, ...)
734738
va_end(args);
735739
}
736740

741+
#if LIBXML_VERSION >= 21200
742+
PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, const xmlError *error)
743+
#else
737744
PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, xmlErrorPtr error)
745+
#endif
738746
{
739747
_php_list_set_error_structure(error, NULL);
740748

@@ -1037,11 +1045,9 @@ PHP_FUNCTION(libxml_use_internal_errors)
10371045
/* {{{ Retrieve last error from libxml */
10381046
PHP_FUNCTION(libxml_get_last_error)
10391047
{
1040-
xmlErrorPtr error;
1041-
10421048
ZEND_PARSE_PARAMETERS_NONE();
10431049

1044-
error = xmlGetLastError();
1050+
const xmlError *error = xmlGetLastError();
10451051

10461052
if (error) {
10471053
object_init_ex(return_value, libxmlerror_class_entry);

ext/soap/php_sdl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
331331
sdl_restore_uri_credentials(ctx);
332332

333333
if (!wsdl) {
334-
xmlErrorPtr xmlErrorPtr = xmlGetLastError();
334+
const xmlError *xmlErrorPtr = xmlGetLastError();
335335

336336
if (xmlErrorPtr) {
337337
soap_error2(E_ERROR, "Parsing WSDL: Couldn't load from '%s' : %s", struri, xmlErrorPtr->message);

0 commit comments

Comments
 (0)