diff options
author | Joe Watkins <krakjoe@php.net> | 2017-02-03 06:10:19 +0000 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2017-02-03 06:12:05 +0000 |
commit | 6988d070ea8c7d44452d8c98e594d65ea722a1d8 (patch) | |
tree | 513218729e8f973cf1f2c4ed2c4c072d0835e4c9 | |
parent | 75ad2b301a047209e7b5a6b5912eb589cfbc773d (diff) | |
parent | 4df993d89da9b78513a75611421e15e100829695 (diff) | |
download | php-git-6988d070ea8c7d44452d8c98e594d65ea722a1d8.tar.gz |
Merge branch 'pull-request/2344' into PHP-7.0
* pull-request/2344:
Fixed bug #74004 LIBXML_NOWARNING (etc) ignored by DOMDocument::loadHTML
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/dom/document.c | 8 | ||||
-rw-r--r-- | ext/dom/tests/bug74004.phpt | 15 |
3 files changed, 23 insertions, 4 deletions
@@ -8,6 +8,10 @@ PHP NEWS . Fixed bug #73998 (array_key_exists fails on arrays created by get_object_vars). (mhagstrand) +- DOM: + . Fixed bug #74004 (LIBXML_NOWARNING (etc) ignored by DOMDocument::loadHTML). + (somedaysummer) + - GD: . Fixed bug #74031 (ReflectionFunction for imagepng is missing last two parameters). (finwe) 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..853dfa5b09 --- /dev/null +++ b/ext/dom/tests/bug74004.phpt @@ -0,0 +1,15 @@ +--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(); +libxml_use_internal_errors(true); +$doc->loadHTML("<tag-throw-warning></tag-throw-warning>",LIBXML_NOWARNING|LIBXML_NOERROR); +print count(libxml_get_errors()); + +?> +--EXPECT-- +0 |