Skip to content

Commit

Permalink
Fix libxml2 2.12 build due to API breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdos committed Dec 1, 2023
1 parent 4eee81b commit 0a39890
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions ext/libxml/libxml.c
Expand Up @@ -472,7 +472,11 @@ static void _php_libxml_free_error(void *ptr)
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;
Expand Down Expand Up @@ -725,7 +729,11 @@ PHP_LIBXML_API void php_libxml_ctx_warning(void *ctx, const char *msg, ...)
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);

Expand Down Expand Up @@ -957,11 +965,9 @@ PHP_FUNCTION(libxml_use_internal_errors)
/* {{{ 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);
Expand Down
2 changes: 1 addition & 1 deletion ext/soap/php_sdl.c
Expand Up @@ -332,7 +332,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
sdl_restore_uri_credentials(ctx);

if (!wsdl) {
xmlErrorPtr xmlErrorPtr = xmlGetLastError();
const xmlError *xmlErrorPtr = xmlGetLastError();

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

4 comments on commit 0a39890

@GrahamCampbell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be on 8.1 too, just like 6a76e5d

@remicollet
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.1 is security only mode only...

BTW as 6a76e5d was applied, could make sense to also apply 0a39890 and 061058a

@GrahamCampbell
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or revert the other commit on 8.1. It is misleading for someone to look at the commit history and think that PHP 8.1 supports libxml 2.12.

@nielsdos
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting would be not good, if there were an issue it should be fixed not reverted.
This commit is not necessary to build php 8.1 with libxml2.12.

Please sign in to comment.