diff --git a/NEWS b/NEWS index bf41d80144c..3df1bdfef9e 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017, PHP 7.1.4 - +- DOM: + . Fixed bug #74004 (LIBXML_NOWARNING flag ingnored on loadHTML*). + (somedaysummer) 16 Mar 2017, PHP 7.1.3 diff --git a/ext/dom/document.c b/ext/dom/document.c index 18d652064e5..cac68300775 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -2038,16 +2038,16 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ RETURN_FALSE; } - if (options) { - htmlCtxtUseOptions(ctxt, (int)options); - } - + ctxt->vctxt.error = php_libxml_ctx_error; ctxt->vctxt.warning = php_libxml_ctx_warning; if (ctxt->sax != NULL) { ctxt->sax->error = php_libxml_ctx_error; ctxt->sax->warning = php_libxml_ctx_warning; } + if (options) { + htmlCtxtUseOptions(ctxt, (int)options); + } htmlParseDocument(ctxt); newdoc = ctxt->myDoc; htmlFreeParserCtxt(ctxt); diff --git a/ext/dom/tests/bug74004.phpt b/ext/dom/tests/bug74004.phpt new file mode 100644 index 00000000000..91a4fbf922e --- /dev/null +++ b/ext/dom/tests/bug74004.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #74004 (DOMDocument->loadHTML and ->loadHTMLFile do not heed LIBXML_NOWARNING and LIBXML_NOERROR options) +--SKIPIF-- + +--FILE-- +loadHTML("",LIBXML_NOERROR); + +?> +===DONE=== +--EXPECT-- +===DONE===