Problem/Motivation
On libxml 2.9.14 there is a difference in DOMDocument::loadHTML()
behavior. The failures are not present in PHP 8.3 with libxml 2.9.10 (tested in Debian bullseye vs bookworm).
Currently, Drupal PHP 8.3 image is using libxml 2.9.14, which causes failures in D7 tests:
https://www.drupal.org/pift-ci-job/2790709
https://www.drupal.org/pift-ci-job/2790712
Similar issue was investigated in D10, but it seems like the solution was to replace DOMDocument
parsing with another library, which seems difficult for D7 in this phase.
See the full history here: #3383577: TextSummaryTest:testLength() fails on some libxml versions
Steps to reproduce
Run tests on PHP 8.3 with libxml 2.9.14
Proposed resolution
Find a workaround how to fix this changed behavior to have green tests again.