mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Stop relying on the deprecated xmlLastError global
This commit is contained in:
@@ -843,14 +843,8 @@ PHP_LIBXML_API void php_libxml_pretend_ctx_error_ex(const char *file, int line,
|
||||
/* Propagate back into libxml */
|
||||
if (LIBXML(error_list)) {
|
||||
xmlErrorPtr last = zend_llist_get_last(LIBXML(error_list));
|
||||
if (last) {
|
||||
if (!last->file) {
|
||||
last->file = strdup(file);
|
||||
}
|
||||
/* Until there is a replacement */
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
xmlCopyError(last, &xmlLastError);
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
if (last && !last->file) {
|
||||
last->file = strdup(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1126,7 +1120,13 @@ PHP_FUNCTION(libxml_get_last_error)
|
||||
{
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
const xmlError *error = xmlGetLastError();
|
||||
const xmlError *error;
|
||||
|
||||
if (LIBXML(error_list)) {
|
||||
error = zend_llist_get_last(LIBXML(error_list));
|
||||
} else {
|
||||
error = xmlGetLastError();
|
||||
}
|
||||
|
||||
if (error) {
|
||||
php_libxml_create_error_object(return_value, error);
|
||||
|
||||
Reference in New Issue
Block a user