]> granicus.if.org Git - php/commitdiff
PHP bug #74004
authorsomedaysummer <info@timothytown.com>
Fri, 27 Jan 2017 20:20:07 +0000 (15:20 -0500)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 2 Mar 2017 11:35:42 +0000 (12:35 +0100)
Fix for DOMDocument loadHTML and loadHTMLFile ignore LIBXML_NOWARNING
and LIBXML_NOERROR flags.

NEWS
ext/dom/document.c
ext/dom/tests/bug74004.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 4d605efe6b67b55e5e49882a18b5ef0c3c720dfb..0aa1a01c63f846bda124655c5cc3751fab43d7f4 100644 (file)
--- 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
 
index cab0aa55ce43a8d1983741b407e7232add83e5cc..a884087f5f0019da1e64d433985ba31bf7341e2c 100644 (file)
@@ -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 (file)
index 0000000..91a4fbf
--- /dev/null
@@ -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===