🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@longwave
Copy link
Contributor

@longwave longwave commented Oct 30, 2025

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #62236
License MIT

Fixes DomCrawler to not crash if it encounters a malformed HTML tag; however the behaviour is still different from the previous version if I naively catch and ignore the exception, as demonstrated by the test case; it should pass on PHP 8.3 and fail on 8.4.

@nicolas-grekas
Copy link
Member

Thanks. The updated behavior makes sense. There's no reason a <script&> should become a <script>. That even looks dangerous.

The test should be added to CrawlerTest.php I think, and have proper skips.

@longwave
Copy link
Contributor Author

Ah I didn't see how the tests extended each other before, I understand now. I think this is the right thing to do? The parsers do act differently but I also think it's worth explicitly asserting what each of them do with this edge case, and we might find similar edge cases in the future.

@nicolas-grekas
Copy link
Member

Thank you @longwave.

@nicolas-grekas nicolas-grekas merged commit 4e517b7 into symfony:7.4 Oct 31, 2025
12 checks passed
This was referenced Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DomCrawler] Native HTML5 parser throws new DOMException on HTML tag containing ampersand

3 participants