Skip to content

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

Closed
@xPaw

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions