mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Suppress libxml deprecations
This commit is contained in:
@@ -1595,12 +1595,16 @@ PHP_METHOD(DOMDocument, save)
|
||||
libxml_doc_props const* doc_props = dom_get_doc_props_read_only(intern->document);
|
||||
bool format = doc_props->formatoutput;
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
saveempty = xmlSaveNoEmptyTags;
|
||||
xmlSaveNoEmptyTags = 1;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
}
|
||||
zend_long bytes = intern->document->handlers->dump_doc_to_file(file, docp, format, (const char *) docp->encoding);
|
||||
if (options & LIBXML_SAVE_NOEMPTYTAG) {
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
xmlSaveNoEmptyTags = saveempty;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
}
|
||||
if (bytes == -1) {
|
||||
RETURN_FALSE;
|
||||
@@ -1641,10 +1645,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
|
||||
|
||||
/* Save libxml2 global, override its value, and restore after saving (don't move me or risk breaking the state
|
||||
* w.r.t. the implicit return in DOM_GET_OBJ). */
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
|
||||
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
res = intern->document->handlers->dump_node_to_str(docp, node, format, (const char *) docp->encoding);
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
} else {
|
||||
int converted_options = XML_SAVE_AS_XML;
|
||||
if (options & XML_SAVE_NO_DECL) {
|
||||
@@ -1655,10 +1663,14 @@ static void dom_document_save_xml(INTERNAL_FUNCTION_PARAMETERS, zend_class_entry
|
||||
}
|
||||
|
||||
/* Save libxml2 global, override its value, and restore after saving. */
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
old_xml_save_no_empty_tags = xmlSaveNoEmptyTags;
|
||||
xmlSaveNoEmptyTags = (options & LIBXML_SAVE_NOEMPTYTAG) ? 1 : 0;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
res = intern->document->handlers->dump_doc_to_str(docp, converted_options, (const char *) docp->encoding);
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
xmlSaveNoEmptyTags = old_xml_save_no_empty_tags;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
|
||||
@@ -1097,7 +1097,10 @@ static int dom_xml_serialize_element_node(
|
||||
/* 14. If ns is the HTML namespace, and the node's list of children is empty, and the node's localName matches
|
||||
* any one of the following void elements: ... */
|
||||
if (element->children == NULL) {
|
||||
if (xmlSaveNoEmptyTags) {
|
||||
ZEND_DIAGNOSTIC_IGNORED_START("-Wdeprecated-declarations")
|
||||
int saveNoEmptyTags = xmlSaveNoEmptyTags;
|
||||
ZEND_DIAGNOSTIC_IGNORED_END
|
||||
if (saveNoEmptyTags) {
|
||||
/* Do nothing, use the <x></x> closing style. */
|
||||
} else if (php_dom_ns_is_fast(element, php_dom_ns_is_html_magic_token)) {
|
||||
size_t name_length = strlen((const char *) element->name);
|
||||
|
||||
@@ -813,9 +813,12 @@ is_string:
|
||||
} 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) {
|
||||
|
||||
Reference in New Issue
Block a user