summaryrefslogtreecommitdiff
path: root/ext/dom
diff options
context:
space:
mode:
authorsomedaysummer <info@timothytown.com>2017-01-27 15:20:07 -0500
committerNikita Popov <nikita.ppv@gmail.com>2017-03-02 12:35:42 +0100
commitfab5ce347c57827b86c658afdb33825cf095cb5e (patch)
tree25c918de61588dffe21f5c330d738502dd526db2 /ext/dom
parentcf60f26da684590d8313852ff2fde2ce788ba119 (diff)
downloadphp-git-fab5ce347c57827b86c658afdb33825cf095cb5e.tar.gz
PHP bug #74004
Fix for DOMDocument loadHTML and loadHTMLFile ignore LIBXML_NOWARNING and LIBXML_NOERROR flags.
Diffstat (limited to 'ext/dom')
-rw-r--r--ext/dom/document.c8
-rw-r--r--ext/dom/tests/bug74004.phpt14
2 files changed, 18 insertions, 4 deletions
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--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$doc=new DOMDocument();
+$doc->loadHTML("<tag-throw></tag-throw>",LIBXML_NOERROR);
+
+?>
+===DONE===
+--EXPECT--
+===DONE===