Skip to content

Incorrect error line numbers reported in Dom\HTMLDocument::createFromString #17486

Closed

Description

@xPaw

Description

<?php

$repeated = str_repeat('a', 50000);

$html = <<<HTML
<!DOCTYPE html>
<html lang="en">
	<body>
		<svg>
			<path d="{$repeated}" />
		</svg>
		<div>&#xa;</div>
	</body>
</html>
HTML;

// this reports tokenizer error control-character-reference in Entity, line: 53, column: 883
$Document = \Dom\HTMLDocument::createFromString($html);

This only happens for tokenizer errors, but not tree errors: change &#xa; to <hr /> and it will correctly report line: 7, column: 9-10.


PHP Version

8.4.3

Operating System

No response

Activity

  1. self-assigned this
    on Jan 16, 2025
  2. added 2 commits that reference this issue on Jan 17, 2025
    72708f2
    21c170c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions