Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

Commit 2a4eb6b

Browse files
committed
html: Avoid HTML_PARSE_HTML5 clashing with XML_PARSE_NOENT
There are several users that pass invalid XML parser options to the HTML parser. Choose a value that is less likely to clash.
1 parent f345296 commit 2a4eb6b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

HTMLparser.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5756,7 +5756,10 @@ htmlCtxtSetOptionsInternal(xmlParserCtxtPtr ctxt, int options, int keepMask)
57565756

57575757
ctxt->linenumbers = 1;
57585758

5759-
return(options & ~allMask);
5759+
/*
5760+
* Allow XML_PARSE_NOENT which many users set on the HTML parser.
5761+
*/
5762+
return(options & ~allMask & ~XML_PARSE_NOENT);
57605763
}
57615764

57625765
/**

include/libxml/HTMLparser.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ XMLPUBFUN void
197197
*/
198198
typedef enum {
199199
HTML_PARSE_RECOVER = 1<<0, /* No effect */
200-
HTML_PARSE_HTML5 = 1<<1, /* HTML5 support */
201200
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
202201
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
203202
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
@@ -208,7 +207,8 @@ typedef enum {
208207
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
209208
HTML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
210209
HTML_PARSE_IGNORE_ENC=1<<21,/* ignore internal document encoding hint */
211-
HTML_PARSE_BIG_LINES= 1<<22 /* Store big lines numbers in text PSVI field */
210+
HTML_PARSE_BIG_LINES= 1<<22,/* Store big lines numbers in text PSVI field */
211+
HTML_PARSE_HTML5 = 1<<26 /* HTML5 support */
212212
} htmlParserOption;
213213

214214
XMLPUBFUN void

0 commit comments

Comments
 (0)