Bug #66712 [NEW]: Using LIBXML_NOHTML_IMPLIED on DomDocument::loadHTML() gives unexpected results
| From: | chanson at mesd dot k12 dot or dot us | Date: | Fri, 14 Feb 2014 01:23:22 +0000 |
| Subject: | Bug #66712 [NEW]: Using LIBXML_NOHTML_IMPLIED on DomDocument::loadHTML() gives unexpected results | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-184296@lists.php.net to get a copy of this message | ||
From: chanson at mesd dot k12 dot or dot us
Operating system: Fedora 20 x86/64
PHP version: 5.5.9
Package: DOM XML related
Bug Type: Bug
Bug description:Using LIBXML_NOHTML_IMPLIED on DomDocument::loadHTML() gives unexpected results
Description:
------------
Using the LIBXML_HTML_NOIMPLIED predefined constant in the DomDocument
class has unexpected results.
The nodeValue of any first DOMNodeList item always contains all the
values of every node list item in the collection only when the optional
LIBXML_HTML_NOIMPLIED predefined constant is passed to the loadHTML()
method.
I am currently running:
- PHP Version 5.5.8
- libxml Version 2.9.1
Test script:
---------------
$html = '<h1>Foo</h1><h2>Bar</h2><p>lorem ipsum</p>';
$dom = new \DomDocument();
$dom->loadHTML($html, LIBXML_HTML_NOIMPLIED);
$nodes = $dom->getElementsByTagName('*');
echo $nodes->item(0)->tagName . ' -> ' . $nodes->item(0)->nodeValue .
'<br/>';
foreach ($nodes as $node) {
echo $node->tagName . ' -> ' . $node->nodeValue . '<br/>';
}
Expected result:
----------------
h1 -> FooBarlorem ipsum
h1 -> FooBarlorem ipsum
h2 -> Bar
p -> lorem ipsum
Actual result:
--------------
h1 -> Foo
h1 -> Foo
h2 -> Bar
p -> lorem ipsum
--
Edit bug report at https://bugs.php.net/bug.php?id=66712&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66712&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66712&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66712&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66712&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66712&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66712&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66712&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66712&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66712&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66712&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66712&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66712&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66712&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66712&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66712&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66712&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66712&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66712&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66712&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66712&r=mysqlcfg