com php-src: PHP bug #74004: NEWS ext/dom/document.c ext/dom/tests/bug74004.phpt

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    fab5ce347c57827b86c658afdb33825cf095cb5e
Author:    somedaysummer <[email protected]>         Fri, 27 Jan 2017 15:20:07 -0500
Committer: Nikita Popov <[email protected]>      Thu, 2 Mar 2017 12:35:42 +0100
Parents:   cf60f26da684590d8313852ff2fde2ce788ba119
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=fab5ce347c57827b86c658afdb33825cf095cb5e

Log:
PHP bug #74004

Fix for DOMDocument loadHTML and loadHTMLFile ignore LIBXML_NOWARNING
and LIBXML_NOERROR flags.

Bugs:
https://bugs.php.net/74004

Changed paths:
  M  NEWS
  M  ext/dom/document.c
  A  ext/dom/tests/bug74004.phpt


Diff:
diff --git a/NEWS b/NEWS
index 4d605ef..0aa1a01 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 cab0aa5..a884087 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 0000000..91a4fbf
--- /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--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc=new DOMDocument();
+$doc->loadHTML("<tag-throw></tag-throw>",LIBXML_NOERROR);
+
+?>
+===DONE===
+--EXPECT--
+===DONE===
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.