]> granicus.if.org Git - php/commitdiff
Bump minimum libxml version to 2.7.6
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 16 Sep 2018 09:48:48 +0000 (11:48 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 23 Sep 2018 13:51:09 +0000 (15:51 +0200)
Released Oct 2009, part of RHEL 6.

18 files changed:
UPGRADING
acinclude.m4
ext/dom/characterdata.c
ext/dom/document.c
ext/dom/tests/DOMDocument_loadXML_error4.phpt
ext/dom/tests/DOMDocument_load_error4.phpt
ext/libxml/libxml.c
ext/soap/php_xml.c
ext/xml/compat.c
ext/xmlreader/php_xmlreader.c
ext/xmlreader/tests/bug42139.phpt
ext/xmlwriter/php_xmlwriter.c
ext/xmlwriter/tests/007.phpt
ext/xmlwriter/tests/011.phpt
ext/xmlwriter/tests/012.phpt
ext/xmlwriter/tests/OO_007.phpt
ext/xmlwriter/tests/OO_010.phpt
ext/xmlwriter/tests/OO_011.phpt

index 629b51b9126482f96ef206220fb0a6fbeb2c08a9..0bb09c6bc46b71057b513a18e15d3106684ce668 100644 (file)
--- 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
index 14dcb62b6804ed20ee811fb51b63dc4269b01817..357cbcfb252554dee6defb4d56ee84cf5b362281 100644 (file)
@@ -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
 
index 8965202c15215a2635eeaf055de5a25dc006fbaa..ccaaf20d2727ec9fc24a40edbc09436a04ae5a57 100644 (file)
@@ -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 */
index 9f9ce5e2f8fb5b2f59a30ea5a40f0ccd27425ae9..201ce6d4b827eeead04dcf435b2abc9b88f0b52e 100644 (file)
@@ -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 {
index 1854a34de4d8bd687b4feeca6f7a8d505e24b80a..e35d3dcea5c83d5efe9f57170360d5671c4cb222 100644 (file)
@@ -12,7 +12,6 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
 assert.bail=true
 --SKIPIF--
 <?php include('skipif.inc'); ?>
-<?php if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required"); ?>
 --ENV--
 XML_FILE=/not_well_formed4.xml
 LOAD_OPTIONS=0
index 9fa6ce279aaaf18a48da82a465c07f441be86b82..ca9ed79a3e84761dc70042b8db58e79c7f405df5 100644 (file)
@@ -12,7 +12,6 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
 assert.bail=true
 --SKIPIF--
 <?php include('skipif.inc'); ?>
-<?php if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required"); ?>
 --ENV--
 XML_FILE=/not_well_formed4.xml
 LOAD_OPTIONS=0
index c12b9a1d9c92179d55d7c35de198e6cfbb0d4956..589fc43442169508db7ac4b2e5fe4be835fede8c 100644 (file)
@@ -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
 
index 2bb6f2f50bc97adcee97acf45cd083356052e305..0035a70f94ba2e6b68766d6f62c21356bebfbe3f 100644 (file)
@@ -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);
index 2018dfa126aee78e5698d6dc7bac72b2989879c9..012e6b134bc60cd24eb92f82a74192c1a976124f 100644 (file)
@@ -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;
        }
index 4d4e7348c93c91b987da99200db706949c9e5d7a..8b5cf34d665bfa5b7ed074f741919db8b7a0c78d 100644 (file)
@@ -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)
 */
index 19602f01035dcc3888fa22e67636ec1c7472d4c6..0ef2d355dd240b9b44aff5f895edfa3a706abfc4 100644 (file)
@@ -1,9 +1,7 @@
 --TEST--
 Bug #42139 (XMLReader option constants are broken using XML())
 --SKIPIF--
-<?php if (!extension_loaded("xmlreader")) print "skip";
-if (LIBXML_VERSION < 20628) die("skip: libxml2 2.6.28+ required");
-?>
+<?php if (!extension_loaded("xmlreader")) print "skip"; ?>
 --FILE--
 <?php
 
index 5c04edb646aa22a4776dad6fc49daced8350200b..7662fe1a3e6d7d595646600f68b94e4ec58a2913 100644 (file)
@@ -33,10 +33,8 @@ static PHP_FUNCTION(xmlwriter_set_indent_string);
 static PHP_FUNCTION(xmlwriter_start_attribute);
 static PHP_FUNCTION(xmlwriter_end_attribute);
 static PHP_FUNCTION(xmlwriter_write_attribute);
-#if LIBXML_VERSION > 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 */
index 08a5b722369c5b8423078efe6217da67074c312f..f1b980a9cc231fc50ecd9e361ddfa35053b6ca3a 100644 (file)
@@ -3,7 +3,6 @@ XMLWriter: libxml2 XML Writer, Elements & Attributes
 --SKIPIF--
 <?php 
 if (!extension_loaded("xmlwriter")) die("skip"); 
-if (LIBXML_VERSION < 20629) die("skip: libxml2 2.6.29+ required");
 ?>
 --FILE--
 <?php 
index 23d0c689d25d36a6620096dfff6e0b50be425674..07d987c2ee1035f4f2d5e8a642d6cefed89b7a50 100644 (file)
@@ -6,7 +6,6 @@ Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
 --SKIPIF--
 <?php 
 if (!extension_loaded("xmlwriter")) die("skip"); 
-if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required");
 ?>
 --FILE--
 <?php 
index 871dc48299e60cd59155f4813923893f22065ccb..f353fe5ab1ea5d9547641f15b6c3670d27e91a92 100644 (file)
@@ -6,7 +6,6 @@ Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
 --SKIPIF--
 <?php
 if (!extension_loaded("xmlwriter")) die("skip");
-if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required");
 ?>
 --FILE--
 <?php
index fd3001d16a42627a6187f347fac0f2df431a0e77..5b41896b75bcfada8e2eb6fdfcb4bf65ba2a3ff5 100644 (file)
@@ -3,7 +3,6 @@ XMLWriter: libxml2 XML Writer, Elements & Attributes
 --SKIPIF--
 <?php 
 if (!extension_loaded("xmlwriter")) die("skip"); 
-if (LIBXML_VERSION < 20629) die("skip: libxml2 2.6.29+ required");
 ?>
 --FILE--
 <?php 
index 7170df58a331a9707626416c9cc2eafa8a1e4e65..5c384797d2092a2ba35c99044aa78ed2224f880f 100644 (file)
@@ -6,7 +6,6 @@ Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
 --SKIPIF--
 <?php 
 if (!extension_loaded("xmlwriter")) die("skip"); 
-if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required");
 ?>
 --FILE--
 <?php 
index b5826d933430bcc01db30a79207b564913ecfce3..5d172b7f335c03ddaa314c8f2017fc27ab944cff 100644 (file)
@@ -6,7 +6,6 @@ Mauricio Vieira <mauricio [at] @mauriciovieira [dot] net>
 --SKIPIF--
 <?php
 if (!extension_loaded("xmlwriter")) die("skip");
-if (LIBXML_VERSION < 20701) die("skip: libxml2 2.7.1+ required");
 ?>
 --FILE--
 <?php