Skip to content

Commit

Permalink
Merge branch 'PHP-8.4'
Browse files Browse the repository at this point in the history
* PHP-8.4:
  NEWS for GH-17485
  Cherry-pick lexbor/lexbor@e58e1e8c
  Cherry-pick lexbor/lexbor@ae97abfb
  Cherry-pick lexbor/lexbor@e39083b0
  • Loading branch information
nielsdos committed Jan 17, 2025
2 parents 5471f11 + 0b04061 commit 0bed3d5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 0 additions & 1 deletion ext/dom/lexbor/lexbor/html/tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ lxb_html_tag_is_void(lxb_tag_id_t tag_id)
case LXB_TAG_INPUT:
case LXB_TAG_LINK:
case LXB_TAG_META:
case LXB_TAG_PARAM:
case LXB_TAG_SOURCE:
case LXB_TAG_TRACK:
case LXB_TAG_WBR:
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/lexbor/lexbor/html/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ lxb_html_tree_acknowledge_token_self_closing(lxb_html_tree_t *tree,

bool is_void = lxb_html_tag_is_void(token->tag_id);

if (is_void) {
if (!is_void) {
lxb_html_tree_parse_error(tree, token,
LXB_HTML_RULES_ERROR_NOVOHTELSTTAWITRSO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@ lxb_html_tree_insertion_mode_foreign_content_anything_else(lxb_html_tree_t *tree
node = lxb_html_tree_current_node(tree);

if (token->tag_id == LXB_TAG_SCRIPT && node->ns == LXB_NS_SVG) {
lxb_html_tree_acknowledge_token_self_closing(tree, token);
return lxb_html_tree_insertion_mode_foreign_content_script_closed(tree, token);
}
else {
lxb_html_tree_open_elements_pop(tree);
lxb_html_tree_acknowledge_token_self_closing(tree, token);
}

return true;
Expand Down
13 changes: 13 additions & 0 deletions ext/dom/tests/modern/html/parser/gh17485.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
GH-17485 (Self-closing tag on void elements shouldn't be a parse error/warning in \Dom\HTMLDocument)
--EXTENSIONS--
dom
--FILE--
<?php
$Data = "<!DOCTYPE HTML>\n<br />\n<input />";
$Document = \Dom\HTMLDocument::createFromString( $Data );
echo $Document->saveHTML();
?>
--EXPECT--
<!DOCTYPE html><html><head></head><body><br>
<input></body></html>

0 comments on commit 0bed3d5

Please sign in to comment.