Skip to content

Commit 92dc0d0

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Suppress libxml deprecations
2 parents 596eec7 + ddc8512 commit 92dc0d0

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

ext/dom/document.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,12 +1597,16 @@ PHP_METHOD(DOMDocument, save)
15971597
libxml_doc_props const* doc_props = dom_get_doc_props_read_only(intern->document);
15981598
bool format = doc_props->formatoutput;
15991599
if (options & LIBXML_SAVE_NOEMPTYTAG) {
1600+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16001601
saveempty = xmlSaveNoEmptyTags;
16011602
xmlSaveNoEmptyTags = 1;
1603+
ZEND_DIAGNOSTIC_IGNORED_END
16021604
}
16031605
zend_long bytes = intern->document->handlers->dump_doc_to_file(file, docp, format, (const char *) docp->encoding);
16041606
if (options & LIBXML_SAVE_NOEMPTYTAG) {
1607+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16051608
xmlSaveNoEmptyTags = saveempty;
1609+
ZEND_DIAGNOSTIC_IGNORED_END
16061610
}
16071611
if (bytes == -1) {
16081612
RETURN_FALSE;
@@ -1643,10 +1647,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
16431647

16441648
/* Save libxml2 global, override its value, and restore after saving (don't move me or risk breaking the state
16451649
* w.r.t. the implicit return in DOM_GET_OBJ). */
1650+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16461651
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
16471652
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
1653+
ZEND_DIAGNOSTIC_IGNORED_END
16481654
res = intern->document->handlers->dump_node_to_str(docp, node, format, (const char *) docp->encoding);
1655+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16491656
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
1657+
ZEND_DIAGNOSTIC_IGNORED_END
16501658
} else {
16511659
int converted_options = XML_SAVE_AS_XML;
16521660
if (options & XML_SAVE_NO_DECL) {
@@ -1657,10 +1665,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
16571665
}
16581666

16591667
/* Save libxml2 global, override its value, and restore after saving. */
1668+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16601669
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
16611670
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
1671+
ZEND_DIAGNOSTIC_IGNORED_END
16621672
res = intern->document->handlers->dump_doc_to_str(docp, converted_options, (const char *) docp->encoding);
1673+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16631674
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
1675+
ZEND_DIAGNOSTIC_IGNORED_END
16641676
}
16651677

16661678
if (!res) {

ext/dom/xml_serializer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,10 @@ static int dom_xml_serialize_element_node(
10971097
/* 14. If ns is the HTML namespace, and the node's list of children is empty, and the node's localName matches
10981098
* any one of the following void elements: ... */
10991099
if (element->children == NULL) {
1100-
if (xmlSaveNoEmptyTags) {
1100+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
1101+
int saveNoEmptyTags = xmlSaveNoEmptyTags;
1102+
ZEND_DIAGNOSTIC_IGNORED_END
1103+
if (saveNoEmptyTags) {
11011104
/* Do nothing, use the <x></x> closing style. */
11021105
} else if (php_dom_ns_is_fast(element, php_dom_ns_is_html_magic_token)) {
11031106
size_t name_length = strlen((const char *) element->name);

ext/libxml/libxml.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,9 +813,12 @@ static xmlParserInputPtr php_libxml_external_entity_loader(const char *URL,
813813
} else {
814814
/* make stream not being closed when the zval is freed */
815815
GC_ADDREF(stream->res);
816+
817+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
816818
pib->context = stream;
817819
pib->readcallback = php_libxml_streams_IO_read;
818820
pib->closecallback = php_libxml_streams_IO_close;
821+
ZEND_DIAGNOSTIC_IGNORED_END
819822

820823
ret = xmlNewIOInputStream(context, pib, enc);
821824
if (ret == NULL) {

0 commit comments

Comments
 (0)