Skip to content

Commit d80be78

Browse files
committed
Stop relying on the deprecated xmlLastError global
1 parent ef80266 commit d80be78

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ext/libxml/libxml.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -843,14 +843,8 @@ PHP_LIBXML_API void php_libxml_pretend_ctx_error_ex(const char *file, int line,
843843
/* Propagate back into libxml */
844844
if (LIBXML(error_list)) {
845845
xmlErrorPtr last = zend_llist_get_last(LIBXML(error_list));
846-
if (last) {
847-
if (!last->file) {
848-
last->file = strdup(file);
849-
}
850-
/* Until there is a replacement */
851-
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
852-
xmlCopyError(last, &xmlLastError);
853-
ZEND_DIAGNOSTIC_IGNORED_END
846+
if (last && !last->file) {
847+
last->file = strdup(file);
854848
}
855849
}
856850
}
@@ -1126,7 +1120,13 @@ PHP_FUNCTION(libxml_get_last_error)
11261120
{
11271121
ZEND_PARSE_PARAMETERS_NONE();
11281122

1129-
const xmlError *error = xmlGetLastError();
1123+
const xmlError *error;
1124+
1125+
if (LIBXML(error_list)) {
1126+
error = zend_llist_get_last(LIBXML(error_list));
1127+
} else {
1128+
error = xmlGetLastError();
1129+
}
11301130

11311131
if (error) {
11321132
php_libxml_create_error_object(return_value, error);

0 commit comments

Comments
 (0)