Skip to content

Fix CI on ubuntu-26.04, whose libxml2 parses HTML as HTML5 - #90

Merged
jakejackson1 merged 1 commit into
mainfrom
fix/ci-ubuntu-26.04
Oct 25, 2026
Merged

jakejackson1 merged 1 commit into
mainfrom
fix/ci-ubuntu-26.04

Conversation

@gravitypdf-bot

Copy link
Copy Markdown
Contributor

GitHub's ubuntu-latest is now ubuntu-26.04, which ships libxml2 2.15. Since 2.14, libxml2's HTML tokenizer follows HTML5:

  • <?php ... ?> is read as a bogus comment (<!--?php ... ?-->), not a processing instruction
  • loadHTML() no longer reports parse errors, even for invalid bytes or undefined entities

That broke 18 Issue65Test tests and DOMQueryTest::testFailedParseHTMLElement (27 failures, 1 error). Neither can apply on the new parser: there is no processing instruction to normalise, and no error to turn into a ParseException.

Changes

  • TestCase::libxmlParsesHtmlAsHtml5() probes the parser once and caches the result. It doesn't read LIBXML_VERSION, because that is the libxml PHP was built against, not necessarily the one it runs with. requireLegacyHtmlParser() skips on it.
  • The six issue Processing instructions gain an extra "?" when an HTML-parsed document is serialized with html()/innerHTML() #65 tests that work on any libxml move to Issue65ParserIndependentTest, so Issue65Test skips once in set_up().
  • A new test checks that the comment libxml 2.14+ produces round trips unchanged.
  • The PHP 8.3 coverage job runs on ubuntu-24.04, so CI still runs the issue Processing instructions gain an extra "?" when an HTML-parsed document is serialized with html()/innerHTML() #65 fix and Codecov still sees it. The old include: - php: '8.3' added a key the matrix doesn't have, which applied report: true to every job; coverage now runs on 8.3 only.
  • actions/checkout v6 → v7 and codecov/codecov-action v5 → v7. checkout v7 only changes pull_request_target/workflow_run, which aren't used here. The codecov directory and token inputs are unchanged.
  • The CHANGELOG notes the user-visible libxml2 2.14+ behaviour of htmlqp().

Testing

  • libxml2 2.15.2 (ubuntu:26.04 container): 395 tests, 30 skipped, 0 failures
  • libxml2 2.9.13 (local): 395 tests, 3 skipped, as before
  • composer run lint and composer run lint:min-php are clean

🤖 Generated with Claude Code

GitHub's ubuntu-latest is now ubuntu-26.04, which ships libxml2 2.15.
libxml2 2.14 rewrote the HTML tokenizer to follow HTML5: `<?...>` is
read as a bogus comment, not a processing instruction, and parse errors
are no longer reported.

- Skip the tests that need the old parser, detected by probing libxml
  rather than reading LIBXML_VERSION (the build-time version)
- Move the issue #65 tests that run on any libxml into their own class,
  so Issue65Test skips once in set_up()
- Pin the comment round trip libxml 2.14+ produces
- Run the coverage job on ubuntu-24.04 so the issue #65 fix stays
  exercised, and only on PHP 8.3 (the old include applied report: true
  to every job)
- Bump actions/checkout to v7 and codecov/codecov-action to v7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jakejackson1 jakejackson1 added the bug Something isn't working label Oct 25, 2026
@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.84%. Comparing base (745a4e2) to head (7ffe1aa).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main      #90      +/-   ##
============================================
- Coverage     90.18%   89.84%   -0.35%     
+ Complexity     1433     1430       -3     
============================================
  Files            26       26              
  Lines          3219     3189      -30     
============================================
- Hits           2903     2865      -38     
- Misses          316      324       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jakejackson1
jakejackson1 merged commit 84b28f8 into main Oct 25, 2026
14 of 15 checks passed
@jakejackson1
jakejackson1 deleted the fix/ci-ubuntu-26.04 branch October 25, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants