Bug #74004 [Ver->Csd]: LIBXML_NOWARNING flag ingnored on loadHTML*

From: Date: Fri, 03 Feb 2017 06:14:12 +0000
Subject: Bug #74004 [Ver->Csd]: LIBXML_NOWARNING flag ingnored on loadHTML*
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207141@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74004&edit=1

 ID:                 74004
 Updated by:         krakjoe@php.net
 Reported by:        work at timothytown dot com
 Summary:            LIBXML_NOWARNING flag ingnored on loadHTML*
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            DOM XML related
 Operating System:   all
 PHP Version:        7.1.1
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of info@timothytown.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4df993d89da9b78513a75611421e15e100829695
Log: Fixed bug #74004 LIBXML_NOWARNING (etc) ignored by DOMDocument::loadHTML


Previous Comments:
------------------------------------------------------------------------
[2017-01-27 19:03:26] cmb@php.net

Confirmed: <https://3v4l.org/vZR37>.

------------------------------------------------------------------------
[2017-01-26 21:35:20] work at timothytown dot com

Description:
------------
The source in the PHP dom extension causes the LIBXML_NOWARNING flag to be ignored when loading html
through DOMDocument.

Problem is in ext/dom/document.c of PHP source, in the dom_load_html method. 
Calling htmlCtxtUseOptions with HTML_PARSE_NOWARNING causes the warning handlers to be unregistered
(set to NULL). But the PHP code then proceeds to install its own handlers unconditionally, rendering
the flag useless. 

see stackoverflow http://stackoverflow.com/questions/41860683/libxml-htmlparsedocument-ignoring-htmlparseoption-flags

Test script:
---------------
$doc=new DOMDocument();
$doc->loadHTML("<tagthatthrowswarning>HI</tagthatthrowswarning>",
LIBXML_NOWARNING);
echo $doc->saveHTML();

Expected result:
----------------
expected output 
no warnings output.


Actual result:
--------------
E_WARNING : type 2 -- DOMDocument::loadHTML(): Tag tagthatthrowswarning invalid in Entity, line: 1
-- at line 4



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74004&edit=1


Thread (6 messages)

« previous php.bugs (#207141) next »