Bug #74004 [NEW]: LIBXML_NOWARNING flag ingnored on loadHTML*
From: work at timothytown dot com
Operating system: all
PHP version: 7.1.1
Package: DOM XML related
Bug Type: Bug
Bug description:LIBXML_NOWARNING flag ingnored on loadHTML*
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 bug report at https://bugs.php.net/bug.php?id=74004&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74004&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74004&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74004&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74004&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74004&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74004&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74004&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74004&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74004&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74004&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74004&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74004&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74004&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74004&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74004&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74004&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74004&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74004&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74004&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74004&r=mysqlcfg
Thread (6 messages)
- work at timothytown dot com