chregu Mon Feb 23 03:21:11 2004 EDT
Modified files:
/php-src/ext/xml compat.c xml.c
Log:
- make it compile with libxml2 2.5 again
- disable xml_parser_create_ns with libxml2 2.5 for the time being
- the #if s can be removed, once we insist on libxml2 2.6
http://cvs.php.net/diff.php/php-src/ext/xml/compat.c?r1=1.26&r2=1.27&ty=u
Index: php-src/ext/xml/compat.c
diff -u php-src/ext/xml/compat.c:1.26 php-src/ext/xml/compat.c:1.27
--- php-src/ext/xml/compat.c:1.26 Sun Feb 22 12:51:01 2004
+++ php-src/ext/xml/compat.c Mon Feb 23 03:21:07 2004
@@ -63,6 +63,7 @@
xmlFree(qualified_name);
}
+#if LIBXML_VERSION >= 20600
static void
_start_element_handler_ns(void *user, const xmlChar *name, const xmlChar *prefix,
const xmlChar *URI, int nb_namespaces, const xmlChar ** namespaces, int nb_attributes,
int nb_defaulted, const xmlChar ** attributes)
{
@@ -77,6 +78,7 @@
xmlFree(qualified_name);
}
+#endif
static void
_namespace_handler(XML_Parser parser, xmlNsPtr nsptr)
@@ -104,6 +106,7 @@
xmlFree(qualified_name);
}
+#if LIBXML_VERSION >= 20600
static void
_end_element_handler_ns(void *user, const xmlChar *name, const xmlChar * prefix,
const xmlChar *URI)
{
@@ -120,6 +123,7 @@
xmlFree(qualified_name);
}
+#endif
static void
_cdata_handler(void *user, const xmlChar *cdata, int cdata_len)
@@ -268,11 +272,14 @@
NULL, /* getParameterEntity */
_cdata_handler, /* cdataBlock */
NULL, /* externalSubset */
- 1,
+ 1
+#if LIBXML_VERSION >= 20600
+ ,
NULL,
_start_element_handler_ns,
_end_element_handler_ns,
NULL
+#endif
};
@@ -314,7 +321,9 @@
parser->parser->replaceEntities = 1;
if (sep != NULL) {
parser->use_namespace = 1;
+#if LIBXML_VERSION >= 20600
parser->parser->sax2 = 1;
+#endif
parser->_ns_seperator = xmlStrdup(sep);
}
return parser;
@@ -396,6 +405,7 @@
PHPAPI int
XML_Parse(XML_Parser parser, const XML_Char *data, int data_len, int is_final)
{
+#if LIBXML_VERSION >= 20600
int error;
error = xmlParseChunk(parser->parser, data, data_len, is_final);
if (!error) {
@@ -405,6 +415,9 @@
} else {
return 1;
}
+#else
+ return !xmlParseChunk(parser->parser, data, data_len, is_final);
+#endif
}
PHPAPI int
http://cvs.php.net/diff.php/php-src/ext/xml/xml.c?r1=1.147&r2=1.148&ty=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.147 php-src/ext/xml/xml.c:1.148
--- php-src/ext/xml/xml.c:1.147 Sat Jan 17 12:44:26 2004
+++ php-src/ext/xml/xml.c Mon Feb 23 03:21:07 2004
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: xml.c,v 1.147 2004/01/17 17:44:26 andrey Exp $ */
+/* $Id: xml.c,v 1.148 2004/02/23 08:21:07 chregu Exp $ */
#define IS_EXT_MODULE
@@ -1109,7 +1109,11 @@
Create an XML parser */
PHP_FUNCTION(xml_parser_create_ns)
{
+#if defined(HAVE_LIBXML) && defined(HAVE_XML) && !defined(HAVE_LIBEXPAT) &&
LIBXML_VERSION < 20600
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "is broken with libxml2 %d. Please
upgrade to libxml2 2.6", LIBXML_DOTTED_VERSION);
+#else
php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+#endif
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php