Description
Description
The following code:
<?php
$Data = "<!DOCTYPE HTML>\n<br />\n<input />";
$Document = \Dom\HTMLDocument::createFromString( $Data );
echo $Document->saveHTML();
Resulted in this output:
Warning: Dom\HTMLDocument::createFromString(): tree error non-void-html-element-start-tag-with-trailing-solidus in Entity, line: 2, column: 2-3 in test.php on line 3
Warning: Dom\HTMLDocument::createFromString(): tree error non-void-html-element-start-tag-with-trailing-solidus in Entity, line: 3, column: 2-6 in test.php on line 3
I believe the html standard specifically allows this on void elements: ref
Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single U+002F SOLIDUS character (/), which on foreign elements marks the start tag as self-closing. On void elements, it does not mark the start tag as self-closing but instead is unnecessary and has no effect of any kind. For such void elements, it should be used only with caution — especially since, if directly preceded by an unquoted attribute value, it becomes part of the attribute value rather than being discarded by the parser.
it doesn't warn for tags like <div />
and simply opens it as normal.
relevant code:
php-src/ext/dom/lexbor/lexbor/html/tree.h
Lines 334 to 339 in 5c39a46
PHP Version
8.4.3
Operating System
No response