From: Nikita Popov Date: Sun, 16 Sep 2018 09:48:48 +0000 (+0200) Subject: Bump minimum libxml version to 2.7.6 X-Git-Tag: php-7.4.0alpha1~1836 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=74235ca5f3fae3325175cf0e68cd7e28c86e1378;p=php Bump minimum libxml version to 2.7.6 Released Oct 2009, part of RHEL 6. --- diff --git a/UPGRADING b/UPGRADING index 629b51b912..0bb09c6bc4 100644 --- a/UPGRADING +++ b/UPGRADING @@ -63,6 +63,9 @@ PHP 7.4 UPGRADE NOTES - Intl: . The Intl extension now requires at least ICU 50.1. +- Libxml: + . All libxml based extensions now require libxml 2.7.6 or newer. + - Reflection: . Numeric value of class, property, function and constant modifiers was changed. Don't filter methods and properties through diff --git a/acinclude.m4 b/acinclude.m4 index 14dcb62b68..357cbcfb25 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2471,12 +2471,12 @@ AC_DEFUN([PHP_SETUP_LIBXML], [ set $libxml_full_version IFS=$ac_IFS LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3` - if test "$LIBXML_VERSION" -ge "2006011"; then + if test "$LIBXML_VERSION" -ge "2007006"; then found_libxml=yes LIBXML_LIBS=`$XML2_CONFIG --libs` LIBXML_INCS=`$XML2_CONFIG --cflags` else - AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.]) + AC_MSG_ERROR([libxml2 version 2.7.6 or greater required.]) fi fi diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index 8965202c15..ccaaf20d27 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -210,19 +210,7 @@ PHP_FUNCTION(dom_characterdata_append_data) } DOM_GET_OBJ(nodep, id, xmlNodePtr, intern); -#if LIBXML_VERSION < 20627 -/* Implement logic from libxml xmlTextConcat to add support for comments and PI */ - if ((nodep->content == (xmlChar *) &(nodep->properties)) || - ((nodep->doc != NULL) && (nodep->doc->dict != NULL) && - xmlDictOwns(nodep->doc->dict, nodep->content))) { - nodep->content = xmlStrncatNew(nodep->content, arg, arg_len); - } else { - nodep->content = xmlStrncat(nodep->content, arg, arg_len); - } - nodep->properties = NULL; -#else xmlTextConcat(nodep, (xmlChar *) arg, arg_len); -#endif RETURN_TRUE; } /* }}} end dom_characterdata_append_data */ diff --git a/ext/dom/document.c b/ext/dom/document.c index 9f9ce5e2f8..201ce6d4b8 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1858,11 +1858,9 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type RETURN_FALSE; } -#if LIBXML_VERSION >= 20614 if (flags & XML_SCHEMA_VAL_VC_I_CREATE) { valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE; } -#endif xmlSchemaSetValidOptions(vptr, valid_opts); xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr); @@ -2213,11 +2211,7 @@ PHP_FUNCTION(dom_document_save_html) xmlBufferFree(buf); } else { int size = 0; -#if LIBXML_VERSION >= 20623 htmlDocDumpMemoryFormat(docp, &mem, &size, format); -#else - htmlDocDumpMemory(docp, &mem, &size); -#endif if (!size || !mem) { RETVAL_FALSE; } else { diff --git a/ext/dom/tests/DOMDocument_loadXML_error4.phpt b/ext/dom/tests/DOMDocument_loadXML_error4.phpt index 1854a34de4..e35d3dcea5 100644 --- a/ext/dom/tests/DOMDocument_loadXML_error4.phpt +++ b/ext/dom/tests/DOMDocument_loadXML_error4.phpt @@ -12,7 +12,6 @@ Antonio Diaz Ruiz assert.bail=true --SKIPIF-- - --ENV-- XML_FILE=/not_well_formed4.xml LOAD_OPTIONS=0 diff --git a/ext/dom/tests/DOMDocument_load_error4.phpt b/ext/dom/tests/DOMDocument_load_error4.phpt index 9fa6ce279a..ca9ed79a3e 100644 --- a/ext/dom/tests/DOMDocument_load_error4.phpt +++ b/ext/dom/tests/DOMDocument_load_error4.phpt @@ -12,7 +12,6 @@ Antonio Diaz Ruiz assert.bail=true --SKIPIF-- - --ENV-- XML_FILE=/not_well_formed4.xml LOAD_OPTIONS=0 diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index c12b9a1d9c..589fc43442 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -805,20 +805,16 @@ static PHP_MINIT_FUNCTION(libxml) REGISTER_LONG_CONSTANT("LIBXML_NOCDATA", XML_PARSE_NOCDATA, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("LIBXML_NONET", XML_PARSE_NONET, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("LIBXML_PEDANTIC", XML_PARSE_PEDANTIC, CONST_CS | CONST_PERSISTENT); -#if LIBXML_VERSION >= 20621 REGISTER_LONG_CONSTANT("LIBXML_COMPACT", XML_PARSE_COMPACT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT("LIBXML_NOXMLDECL", XML_SAVE_NO_DECL, CONST_CS | CONST_PERSISTENT); -#endif -#if LIBXML_VERSION >= 20703 REGISTER_LONG_CONSTANT("LIBXML_PARSEHUGE", XML_PARSE_HUGE, CONST_CS | CONST_PERSISTENT); -#endif #if LIBXML_VERSION >= 20900 REGISTER_LONG_CONSTANT("LIBXML_BIGLINES", XML_PARSE_BIG_LINES, CONST_CS | CONST_PERSISTENT); #endif REGISTER_LONG_CONSTANT("LIBXML_NOEMPTYTAG", LIBXML_SAVE_NOEMPTYTAG, CONST_CS | CONST_PERSISTENT); /* Schema validation options */ -#if defined(LIBXML_SCHEMAS_ENABLED) && LIBXML_VERSION >= 20614 +#if defined(LIBXML_SCHEMAS_ENABLED) REGISTER_LONG_CONSTANT("LIBXML_SCHEMA_CREATE", XML_SCHEMA_VAL_VC_I_CREATE, CONST_CS | CONST_PERSISTENT); #endif diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c index 2bb6f2f50b..0035a70f94 100644 --- a/ext/soap/php_xml.c +++ b/ext/soap/php_xml.c @@ -99,9 +99,7 @@ xmlDocPtr soap_xmlParseFile(const char *filename) ctxt->sax->warning = NULL; ctxt->sax->error = NULL; /*ctxt->sax->fatalError = NULL;*/ -#if LIBXML_VERSION >= 20703 ctxt->options |= XML_PARSE_HUGE; -#endif old = php_libxml_disable_entity_loader(1); xmlParseDocument(ctxt); php_libxml_disable_entity_loader(old); @@ -148,9 +146,7 @@ xmlDocPtr soap_xmlParseMemory(const void *buf, size_t buf_size) ctxt->sax->warning = NULL; ctxt->sax->error = NULL; /*ctxt->sax->fatalError = NULL;*/ -#if LIBXML_VERSION >= 20703 ctxt->options |= XML_PARSE_HUGE; -#endif old = php_libxml_disable_entity_loader(1); xmlParseDocument(ctxt); php_libxml_disable_entity_loader(old); diff --git a/ext/xml/compat.c b/ext/xml/compat.c index 2018dfa126..012e6b134b 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -467,15 +467,8 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *m efree(parser); return NULL; } -#if LIBXML_VERSION <= 20617 - /* for older versions of libxml2, allow correct detection of - * charset in documents with a BOM: */ - parser->parser->charset = XML_CHAR_ENCODING_NONE; -#endif -#if LIBXML_VERSION >= 20703 xmlCtxtUseOptions(parser->parser, XML_PARSE_OLDSAX); -#endif parser->parser->replaceEntities = 1; parser->parser->wellFormed = 0; @@ -569,30 +562,6 @@ XML_Parse(XML_Parser parser, const XML_Char *data, int data_len, int is_final) { int error; -/* The following is a hack to keep BC with PHP 4 while avoiding -the inifite loop in libxml <= 2.6.17 which occurs when no encoding -has been defined and none can be detected */ -#if LIBXML_VERSION <= 20617 - if (parser->parser->charset == XML_CHAR_ENCODING_NONE) { - if (data_len >= 4 || (parser->parser->input->buf->buffer->use + data_len >= 4)) { - xmlChar start[4]; - int char_count; - - char_count = parser->parser->input->buf->buffer->use; - if (char_count > 4) { - char_count = 4; - } - - memcpy(start, parser->parser->input->buf->buffer->content, (size_t)char_count); - memcpy(start + char_count, data, (size_t)(4 - char_count)); - - if (xmlDetectCharEncoding(&start[0], 4) == XML_CHAR_ENCODING_NONE) { - parser->parser->charset = XML_CHAR_ENCODING_UTF8; - } - } - } -#endif - if (parser->parser->lastError.level >= XML_ERR_WARNING) { return 0; } diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 4d4e7348c9..8b5cf34d66 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -442,7 +442,6 @@ static void php_xmlreader_free_prop_handler(zval *el) /* {{{ */ { pefree(Z_PTR_P(el), 1); } /* }}} */ -#if LIBXML_VERSION >= 20620 /* {{{ php_xmlreader_no_arg_string */ static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_read_char_t internal_function) { zval *id; @@ -464,7 +463,6 @@ static void php_xmlreader_no_arg_string(INTERNAL_FUNCTION_PARAMETERS, xmlreader_ } } /* }}} */ -#endif /* {{{ php_xmlreader_set_relaxng_schema */ static void php_xmlreader_set_relaxng_schema(INTERNAL_FUNCTION_PARAMETERS, int type) { @@ -810,12 +808,6 @@ PHP_METHOD(xmlreader, next) id = getThis(); intern = Z_XMLREADER_P(id); if (intern != NULL && intern->ptr != NULL) { -#if LIBXML_VERSION <= 20617 - /* Bug in libxml prevents a next in certain cases when positioned on end of element */ - if (xmlTextReaderNodeType(intern->ptr) == XML_READER_TYPE_END_ELEMENT) { - retval = xmlTextReaderRead(intern->ptr); - } else -#endif retval = xmlTextReaderNext(intern->ptr); while (name != NULL && retval == 1) { if (xmlStrEqual(xmlTextReaderConstLocalName(intern->ptr), (xmlChar *)name)) { @@ -899,7 +891,6 @@ PHP_METHOD(xmlreader, resetState) } */ -#if LIBXML_VERSION >= 20620 /* {{{ proto string XMLReader::readInnerXml() Reads the contents of the current node, including child nodes and markup. */ PHP_METHOD(xmlreader, readInnerXml) @@ -965,7 +956,6 @@ PHP_METHOD(xmlreader, setSchema) #endif } /* }}} */ -#endif /* {{{ proto bool XMLReader::setParserProperty(int property, bool value) Sets parser property (one of the parser option constants). @@ -1071,9 +1061,7 @@ PHP_METHOD(xmlreader, XML) reader = xmlNewTextReader(inputbfr, uri); if (reader != NULL) { -#if LIBXML_VERSION >= 20628 ret = xmlTextReaderSetup(reader, NULL, uri, encoding, options); -#endif if (ret == 0) { if (id == NULL) { object_init_ex(return_value, xmlreader_class_entry); @@ -1271,12 +1259,10 @@ static const zend_function_entry xmlreader_functions[] /* {{{ */ = { PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) PHP_ME(xmlreader, read, arginfo_xmlreader_read, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, next, arginfo_xmlreader_next, ZEND_ACC_PUBLIC) -#if LIBXML_VERSION >= 20620 PHP_ME(xmlreader, readInnerXml, arginfo_xmlreader_readInnerXml, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, readOuterXml, arginfo_xmlreader_readOuterXml, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, readString, arginfo_xmlreader_readString, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, setSchema, arginfo_xmlreader_setSchema, ZEND_ACC_PUBLIC) -#endif /* Not Yet Implemented though defined in libxml as of 2.6.9dev PHP_ME(xmlreader, resetState, NULL, ZEND_ACC_PUBLIC) */ diff --git a/ext/xmlreader/tests/bug42139.phpt b/ext/xmlreader/tests/bug42139.phpt index 19602f0103..0ef2d355dd 100644 --- a/ext/xmlreader/tests/bug42139.phpt +++ b/ext/xmlreader/tests/bug42139.phpt @@ -1,9 +1,7 @@ --TEST-- Bug #42139 (XMLReader option constants are broken using XML()) --SKIPIF-- - + --FILE-- 20617 static PHP_FUNCTION(xmlwriter_start_attribute_ns); static PHP_FUNCTION(xmlwriter_write_attribute_ns); -#endif static PHP_FUNCTION(xmlwriter_start_element); static PHP_FUNCTION(xmlwriter_end_element); static PHP_FUNCTION(xmlwriter_full_end_element); @@ -463,10 +461,8 @@ static const zend_function_entry xmlwriter_functions[] = { PHP_FE(xmlwriter_start_attribute, arginfo_xmlwriter_start_attribute) PHP_FE(xmlwriter_end_attribute, arginfo_xmlwriter_resource) PHP_FE(xmlwriter_write_attribute, arginfo_xmlwriter_write_attribute) -#if LIBXML_VERSION > 20617 PHP_FE(xmlwriter_start_attribute_ns,arginfo_xmlwriter_start_attribute_ns) PHP_FE(xmlwriter_write_attribute_ns,arginfo_xmlwriter_write_attribute_ns) -#endif PHP_FE(xmlwriter_start_element, arginfo_xmlwriter_start_element) PHP_FE(xmlwriter_end_element, arginfo_xmlwriter_resource) PHP_FE(xmlwriter_full_end_element, arginfo_xmlwriter_resource) @@ -513,10 +509,8 @@ static const zend_function_entry xmlwriter_class_functions[] = { PHP_ME_MAPPING(startAttribute, xmlwriter_start_attribute, arginfo_xmlwriter_method_start_attribute, 0) PHP_ME_MAPPING(endAttribute, xmlwriter_end_attribute, arginfo_xmlwriter_void, 0) PHP_ME_MAPPING(writeAttribute, xmlwriter_write_attribute, arginfo_xmlwriter_method_write_attribute, 0) -#if LIBXML_VERSION > 20617 PHP_ME_MAPPING(startAttributeNs, xmlwriter_start_attribute_ns,arginfo_xmlwriter_method_start_attribute_ns, 0) PHP_ME_MAPPING(writeAttributeNs, xmlwriter_write_attribute_ns,arginfo_xmlwriter_method_write_attribute_ns, 0) -#endif PHP_ME_MAPPING(startElement, xmlwriter_start_element, arginfo_xmlwriter_method_start_element, 0) PHP_ME_MAPPING(endElement, xmlwriter_end_element, arginfo_xmlwriter_void, 0) PHP_ME_MAPPING(fullEndElement, xmlwriter_full_end_element, arginfo_xmlwriter_void, 0) @@ -808,7 +802,6 @@ static PHP_FUNCTION(xmlwriter_end_attribute) } /* }}} */ -#if LIBXML_VERSION > 20617 /* {{{ proto bool xmlwriter_start_attribute_ns(resource xmlwriter, string prefix, string name, string uri) Create start namespaced attribute - returns FALSE on error */ static PHP_FUNCTION(xmlwriter_start_attribute_ns) @@ -851,7 +844,6 @@ static PHP_FUNCTION(xmlwriter_start_attribute_ns) RETURN_FALSE; } /* }}} */ -#endif /* {{{ proto bool xmlwriter_write_attribute(resource xmlwriter, string name, string content) Write full attribute - returns FALSE on error */ @@ -896,7 +888,6 @@ static PHP_FUNCTION(xmlwriter_write_attribute) } /* }}} */ -#if LIBXML_VERSION > 20617 /* {{{ proto bool xmlwriter_write_attribute_ns(resource xmlwriter, string prefix, string name, string uri, string content) Write full namespaced attribute - returns FALSE on error */ static PHP_FUNCTION(xmlwriter_write_attribute_ns) @@ -940,7 +931,6 @@ static PHP_FUNCTION(xmlwriter_write_attribute_ns) RETURN_FALSE; } /* }}} */ -#endif /* {{{ proto bool xmlwriter_start_element(resource xmlwriter, string name) Create start element tag - returns FALSE on error */ diff --git a/ext/xmlwriter/tests/007.phpt b/ext/xmlwriter/tests/007.phpt index 08a5b72236..f1b980a9cc 100644 --- a/ext/xmlwriter/tests/007.phpt +++ b/ext/xmlwriter/tests/007.phpt @@ -3,7 +3,6 @@ XMLWriter: libxml2 XML Writer, Elements & Attributes --SKIPIF-- --FILE-- --SKIPIF-- --FILE-- --SKIPIF-- --FILE-- --FILE-- --SKIPIF-- --FILE-- --SKIPIF-- --FILE--