Skip to content

Commit ed847f4

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Suppress libxml deprecations
2 parents 355d296 + 685bd9d commit ed847f4

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
@@ -1599,12 +1599,16 @@ PHP_METHOD(DOMDocument, save)
15991599
libxml_doc_props const* doc_props = dom_get_doc_props_read_only(intern->document);
16001600
bool format = doc_props->formatoutput;
16011601
if (options & LIBXML_SAVE_NOEMPTYTAG) {
1602+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16021603
saveempty = xmlSaveNoEmptyTags;
16031604
xmlSaveNoEmptyTags = 1;
1605+
ZEND_DIAGNOSTIC_IGNORED_END
16041606
}
16051607
zend_long bytes = intern->document->handlers->dump_doc_to_file(file, docp, format, (const char *) docp->encoding);
16061608
if (options & LIBXML_SAVE_NOEMPTYTAG) {
1609+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16071610
xmlSaveNoEmptyTags = saveempty;
1611+
ZEND_DIAGNOSTIC_IGNORED_END
16081612
}
16091613
if (bytes == -1) {
16101614
RETURN_FALSE;
@@ -1645,10 +1649,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
16451649

16461650
/* Save libxml2 global, override its value, and restore after saving (don't move me or risk breaking the state
16471651
* w.r.t. the implicit return in DOM_GET_OBJ). */
1652+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16481653
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
16491654
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
1655+
ZEND_DIAGNOSTIC_IGNORED_END
16501656
res = intern->document->handlers->dump_node_to_str(docp, node, format, (const char *) docp->encoding);
1657+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16511658
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
1659+
ZEND_DIAGNOSTIC_IGNORED_END
16521660
} else {
16531661
int converted_options = XML_SAVE_AS_XML;
16541662
if (options & XML_SAVE_NO_DECL) {
@@ -1659,10 +1667,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
16591667
}
16601668

16611669
/* Save libxml2 global, override its value, and restore after saving. */
1670+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16621671
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
16631672
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
1673+
ZEND_DIAGNOSTIC_IGNORED_END
16641674
res = intern->document->handlers->dump_doc_to_str(docp, converted_options, (const char *) docp->encoding);
1675+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
16651676
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
1677+
ZEND_DIAGNOSTIC_IGNORED_END
16661678
}
16671679

16681680
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
@@ -809,9 +809,12 @@ static xmlParserInputPtr _php_libxml_external_entity_loader(const char *URL,
809809
} else {
810810
/* make stream not being closed when the zval is freed */
811811
GC_ADDREF(stream->res);
812+
813+
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
812814
pib->context = stream;
813815
pib->readcallback = php_libxml_streams_IO_read;
814816
pib->closecallback = php_libxml_streams_IO_close;
817+
ZEND_DIAGNOSTIC_IGNORED_END
815818

816819
ret = xmlNewIOInputStream(context, pib, enc);
817820
if (ret == NULL) {

0 commit comments

Comments
 (0)