Skip to content

Commit

Permalink
Fixed bug #30832 ("!" stripped off comments in xml parser)
Browse files Browse the repository at this point in the history
reset sax->initialized flag when not using SAX2
  • Loading branch information
Rob Richards committed Nov 18, 2004
1 parent 2496f4f commit 1e0212e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions ext/xml/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ _notation_decl_handler(void *user, const xmlChar *notation, const xmlChar *sys_i
static void
_build_comment(const xmlChar *data, int data_len, xmlChar **comment, int *comment_len)
{
*comment_len = data_len + 6;
*comment_len = data_len + 7;

*comment = xmlMalloc(*comment_len + 1);
memcpy(*comment, "<--", 3);
memcpy(*comment + 3, data, data_len);
memcpy(*comment + 3 + data_len, "-->", 3);
memcpy(*comment, "<!--", 4);
memcpy(*comment + 4, data, data_len);
memcpy(*comment + 4 + data_len, "-->", 3);

(*comment)[*comment_len] = '\0';
}
Expand Down Expand Up @@ -359,6 +359,12 @@ XML_ParserCreate_MM(const XML_Char *encoding, const XML_Memory_Handling_Suite *m
parser->parser->sax2 = 1;
#endif
parser->_ns_seperator = xmlStrdup(sep);
#if LIBXML_VERSION >= 20600
} else {
/* Reset flag as XML_SAX2_MAGIC is needed for xmlCreatePushParserCtxt
so must be set in the handlers */
parser->parser->sax->initialized = 1;
#endif
}
return parser;
}
Expand Down

0 comments on commit 1e0212e

Please sign in to comment.