Commit f7fb13eb07e for php.net
commit f7fb13eb07e8a75c1ed24dcf4edb177879c24f5d
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Tue Dec 2 16:26:50 2025 +0100
Suppress libxml deprecations
Closes GH-20538
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 431d69a89dc..15b5d98131c 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1437,12 +1437,16 @@ PHP_METHOD(DOMDocument, save)
doc_props = dom_get_doc_props(intern->document);
format = doc_props->formatoutput;
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
bytes = xmlSaveFormatFileEnc(file, docp, NULL, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
xmlSaveNoEmptyTags = saveempty;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
if (bytes == -1) {
RETURN_FALSE;
@@ -1489,12 +1493,16 @@ PHP_METHOD(DOMDocument, saveXML)
RETURN_FALSE;
}
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
xmlNodeDump(buf, docp, node, 0, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
xmlSaveNoEmptyTags = saveempty;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
mem = (xmlChar*) xmlBufferContent(buf);
if (!mem) {
@@ -1505,13 +1513,17 @@ PHP_METHOD(DOMDocument, saveXML)
xmlBufferFree(buf);
} else {
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
saveempty = xmlSaveNoEmptyTags;
xmlSaveNoEmptyTags = 1;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
/* Encoding is handled from the encoding property set on the document */
xmlDocDumpFormatMemory(docp, &mem, &size, format);
if (options & LIBXML_SAVE_NOEMPTYTAG) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
xmlSaveNoEmptyTags = saveempty;
+ ZEND_DIAGNOSTIC_IGNORED_END
}
if (!size || !mem) {
RETURN_FALSE;
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 3311346d4bc..f60aa1bf76b 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -429,9 +429,11 @@ php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
/* Allocate the Input buffer front-end. */
ret = xmlAllocParserInputBuffer(enc);
if (ret != NULL) {
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
ret->context = context;
ret->readcallback = php_libxml_streams_IO_read;
ret->closecallback = php_libxml_streams_IO_close;
+ ZEND_DIAGNOSTIC_IGNORED_END
} else
php_libxml_streams_IO_close(context);
@@ -679,9 +681,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
} else {
/* make stream not being closed when the zval is freed */
GC_ADDREF(stream->res);
+
+ ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
pib->context = stream;
pib->readcallback = php_libxml_streams_IO_read;
pib->closecallback = php_libxml_streams_IO_close;
+ ZEND_DIAGNOSTIC_IGNORED_END
ret = xmlNewIOInputStream(context, pib, enc);
if (ret == NULL) {