Doc->Bug #66712 [Ver->Csd]: Using LIBXML_HTML_NOIMPLIED on DomDocument::loadHTML() gives unexpected results
| From: | nielsdos@php.net | Date: | Thu, 07 Sep 2023 18:46:12 +0000 |
| Subject: | Doc->Bug #66712 [Ver->Csd]: Using LIBXML_HTML_NOIMPLIED on DomDocument::loadHTML() gives unexpected results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-245360@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66712&edit=1
ID: 66712
Updated by: nielsdos@php.net
Reported by: chanson at mesd dot k12 dot or dot us
Summary: Using LIBXML_HTML_NOIMPLIED on
DomDocument::loadHTML() gives unexpected results
-Status: Verified
+Status: Closed
-Type: Documentation Problem
+Type: Bug
Package: DOM XML related
Operating System: Fedora 20 x86/64
PHP Version: 5.5.9
-Assigned To:
+Assigned To: nielsdos
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.
Fixed in libxml2.
Previous Comments:
------------------------------------------------------------------------
[2023-09-07 18:45:32] nielsdos@php.net
I contacted the libxml2 developer, and he confirmed it *is* actually a bug and has fixed the bug: https://gitlab.gnome.org/GNOME/libxml2/-/issues/584
The next release of libxml2 will have the right behaviour, i.e. no nesting inside h1.
------------------------------------------------------------------------
[2023-06-08 20:45:01] nielsdos@php.net
Agreed that this is a documentation issue. The document element indeed becomes the <h1> tag
and everything becomes nested under it: <h1>Foo<h2>Bar</h2><p>lorem
ipsum</p></h1>
I think this is correct behaviour.
------------------------------------------------------------------------
[2015-11-09 14:47:01] dlundgren at syberisle dot net
This may be more of a documentation issue than a code issue. After encountering the same problem
recently, I found that the first element becomes the root element of the document. To offset this I
wrapped the html fragment in a root element, and I was able to work with it that way.
This is most likely due to our lack of understanding that the DOM Level 2 requires a document to
have a single documentElement, with children under it. I had to look that up to understand what I
was doing wrong.
------------------------------------------------------------------------
[2015-04-15 14:46:01] cmb@php.net
Well, of course the behavior is reproducible -- only the expected
and actual behavior sections in the report are mixed up.
------------------------------------------------------------------------
[2015-04-15 14:41:47] cmb@php.net
I am not able to reproduce this behavior, see
<http://3v4l.org/SFlNo>. Can you confirm?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=66712
--
Edit this bug report at https://bugs.php.net/bug.php?id=66712&edit=1