|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-04-15 14:41 UTC] cmb@php.net
-Summary: Using LIBXML_NOHTML_IMPLIED on
DomDocument::loadHTML() gives unexpected results
+Summary: Using LIBXML_HTML_NOIMPLIED on
DomDocument::loadHTML() gives unexpected results
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2015-04-15 14:41 UTC] cmb@php.net
[2015-04-15 14:46 UTC] cmb@php.net
-Status: Feedback
+Status: Verified
-Assigned To: cmb
+Assigned To:
[2015-04-15 14:46 UTC] cmb@php.net
[2015-11-09 14:47 UTC] dlundgren at syberisle dot net
[2023-06-08 20:45 UTC] nielsdos@php.net
-Type: Bug
+Type: Documentation Problem
[2023-06-08 20:45 UTC] nielsdos@php.net
[2023-09-07 18:45 UTC] nielsdos@php.net
[2023-09-07 18:46 UTC] nielsdos@php.net
-Status: Verified
+Status: Closed
-Type: Documentation Problem
+Type: Bug
-Assigned To:
+Assigned To: nielsdos
[2023-09-07 18:46 UTC] nielsdos@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 14:00:01 2025 UTC |
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