From fab5ce347c57827b86c658afdb33825cf095cb5e Mon Sep 17 00:00:00 2001 From: somedaysummer Date: Fri, 27 Jan 2017 15:20:07 -0500 Subject: PHP bug #74004 Fix for DOMDocument loadHTML and loadHTMLFile ignore LIBXML_NOWARNING and LIBXML_NOERROR flags. --- NEWS | 4 +++- ext/dom/document.c | 8 ++++---- ext/dom/tests/bug74004.phpt | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 ext/dom/tests/bug74004.phpt diff --git a/NEWS b/NEWS index 4d605efe6b..0aa1a01c63 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017 PHP 7.0.18 - +- DOM: + . Fixed bug #74004 (LIBXML_NOWARNING flag ingnored on loadHTML*). + (somedaysummer) 16 Mar 2017 PHP 7.0.17 diff --git a/ext/dom/document.c b/ext/dom/document.c index cab0aa55ce..a884087f5f 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 0000000000..91a4fbf922 --- /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=== -- cgit v1.2.1