FreeBSD Bugzilla – Attachment 93761 Details for
Bug 131744
textproc/php5-xml generates wrong output.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 5.29 KB, created by
TsurutaniNaoki
on 2009-02-16 13:10:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
TsurutaniNaoki
Created:
2009-02-16 13:10:01 UTC
Size:
5.29 KB
patch
obsolete
>--- patch-compat.c.orig 2004-07-20 18:03:42.000000000 +0900 >+++ patch-compat.c 2009-02-16 11:20:48.000000000 +0900 >@@ -1,9 +1,18 @@ >---- compat.c.orig Tue Jul 20 10:55:02 2004 >-+++ compat.c Tue Jul 20 10:55:55 2004 >+--- compat.c.orig 2007-12-31 16:20:14.000000000 +0900 >++++ compat.c 2009-01-13 00:45:21.000000000 +0900 >+@@ -2,7 +2,7 @@ >+ +----------------------------------------------------------------------+ >+ | PHP Version 5 | >+ +----------------------------------------------------------------------+ >+- | Copyright (c) 1997-2008 The PHP Group | >++ | Copyright (c) 1997-2009 The PHP Group | >+ +----------------------------------------------------------------------+ >+ | This source file is subject to version 3.01 of the PHP license, | >+ | that is bundled with this package in the file LICENSE, and is | > @@ -16,6 +16,10 @@ > +----------------------------------------------------------------------+ > */ >- >+ > +#ifdef HAVE_CONFIG_H > +#include "config.h" > +#endif >@@ -11,3 +20,131 @@ > #include "php.h" > #if defined(HAVE_LIBXML) && defined(HAVE_XML) && !defined(HAVE_LIBEXPAT) > #include "expat_compat.h" >+@@ -40,7 +44,7 @@ >+ /* Use libxml functions otherwise its memory deallocation is screwed up */ >+ *qualified = xmlStrdup(URI); >+ *qualified = xmlStrncat(*qualified, parser->_ns_seperator, 1); >+- *qualified = xmlStrncat(*qualified, name, strlen(name)); >++ *qualified = xmlStrncat(*qualified, name, xmlStrlen(name)); >+ } else { >+ *qualified = xmlStrdup(name); >+ } >+@@ -104,7 +108,66 @@ >+ y = 0; >+ } >+ >+- if (parser->h_start_element == NULL && parser->h_default == NULL) { >++ if (parser->h_start_element == NULL) { >++ if (parser->h_default) { >++ >++ if (prefix) { >++ qualified_name = xmlStrncatNew((xmlChar *)"<", prefix, xmlStrlen(prefix)); >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)":", 1); >++ qualified_name = xmlStrncat(qualified_name, name, xmlStrlen(name)); >++ } else { >++ qualified_name = xmlStrncatNew((xmlChar *)"<", name, xmlStrlen(name)); >++ } >++ >++ if (namespaces) { >++ int i, j; >++ for (i = 0,j = 0;j < nb_namespaces;j++) { >++ int ns_len; >++ char *ns_string, *ns_prefix, *ns_url; >++ >++ ns_prefix = (char *) namespaces[i++]; >++ ns_url = (char *) namespaces[i++]; >++ >++ if (ns_prefix) { >++ ns_len = spprintf(&ns_string, 0, " xmlns:%s=\"%s\"", ns_prefix, ns_url); >++ } else { >++ ns_len = spprintf(&ns_string, 0, " xmlns=\"%s\"", ns_url); >++ } >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)ns_string, ns_len); >++ >++ efree(ns_string); >++ } >++ } >++ >++ if (attributes) { >++ for (i = 0; i < nb_attributes; i += 1) { >++ int att_len; >++ char *att_string, *att_name, *att_value, *att_prefix, *att_valueend; >++ >++ att_name = (char *) attributes[y++]; >++ att_prefix = (char *)attributes[y++]; >++ y++; >++ att_value = (char *)attributes[y++]; >++ att_valueend = (char *)attributes[y++]; >++ >++ if (att_prefix) { >++ att_len = spprintf(&att_string, 0, " %s:%s=\"", att_prefix, att_name); >++ } else { >++ att_len = spprintf(&att_string, 0, " %s=\"", att_name); >++ } >++ >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)att_string, att_len); >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)att_value, att_valueend - att_value); >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)"\"", 1); >++ >++ efree(att_string); >++ } >++ >++ } >++ qualified_name = xmlStrncat(qualified_name, (xmlChar *)">", 1); >++ parser->h_default(parser->user, (const XML_Char *) qualified_name, xmlStrlen(qualified_name)); >++ xmlFree(qualified_name); >++ } >+ return; >+ } >+ _qualify_namespace(parser, name, URI, &qualified_name); >+@@ -178,6 +241,18 @@ >+ XML_Parser parser = (XML_Parser) user; >+ >+ if (parser->h_end_element == NULL) { >++ if (parser->h_default) { >++ char *end_element; >++ int end_element_len; >++ >++ if (prefix) { >++ end_element_len = spprintf(&end_element, 0, "</%s:%s>", (char *) prefix, (char *)name); >++ } else { >++ end_element_len = spprintf(&end_element, 0, "</%s>", (char *)name); >++ } >++ parser->h_default(parser->user, (const XML_Char *) end_element, end_element_len); >++ efree(end_element); >++ } >+ return; >+ } >+ >+@@ -212,7 +287,7 @@ >+ if (parser->h_default) { >+ char *full_pi; >+ spprintf(&full_pi, 0, "<?%s %s?>", (char *)target, (char *)data); >+- parser->h_default(parser->user, (const XML_Char *) full_pi, xmlStrlen(full_pi)); >++ parser->h_default(parser->user, (const XML_Char *) full_pi, strlen(full_pi)); >+ efree(full_pi); >+ } >+ return; >+@@ -411,6 +486,10 @@ >+ 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; >+ if (sep != NULL) { >+@@ -545,10 +624,10 @@ >+ >+ static const XML_Char *const error_mapping[] = { >+ "No error", >+- "Internal error", >+ "No memory", >+ "Invalid document start", >+ "Empty document", >++ "Not well-formed (invalid token)", >+ "Invalid document end", >+ "Invalid hexadecimal character reference", >+ "Invalid decimal character reference",
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 131744
: 93761