diff options
author | Rob Richards <rrichards@php.net> | 2004-11-18 18:26:13 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2004-11-18 18:26:13 +0000 |
commit | 1e0212ef8e4b7901d563e3cdd143b039b8517a8b (patch) | |
tree | a81c0fd963474eba9a94c42c7daef0464a2e6bdd | |
parent | 2496f4f882b225c84bb81474aad5a6a12d3d5f12 (diff) | |
download | php-git-1e0212ef8e4b7901d563e3cdd143b039b8517a8b.tar.gz |
Fixed bug #30832 ("!" stripped off comments in xml parser)
reset sax->initialized flag when not using SAX2
-rw-r--r-- | ext/xml/compat.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/xml/compat.c b/ext/xml/compat.c index c8cdf18110..d2154929a5 100644 --- a/ext/xml/compat.c +++ b/ext/xml/compat.c @@ -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'; } @@ -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; } |