Skip to content

Suppress Libxml Warnings in Reader/Html#4761

Merged
oleibman merged 3 commits intoPHPOffice:masterfrom
oleibman:htmlwarn
Dec 29, 2025
Merged

Suppress Libxml Warnings in Reader/Html#4761
oleibman merged 3 commits intoPHPOffice:masterfrom
oleibman:htmlwarn

Conversation

@oleibman
Copy link
Collaborator

@oleibman oleibman commented Dec 27, 2025

Fix #647, which went stale in 2019 and is now reopened.

Fix #849, which went stale in 2019 and is now reopened.

Html Reader currently echoes any warning messages from Dom::loadHtml when it parses Html input. These are generally not needed, and may cause PhpSpreadsheet to fail needlessly. A new property $suppressLoadWarnings is added. It will initially default to null, which will avoid any BC breaks. However, the default will be changed to true in a future release. Should the caller be interested in any messages which are suppressed when true is in effect, these are available through new method getLibxmlMessages after the Html has been loaded.

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Fix PHPOffice#647, which went stale in 2019 and is now reopened.

Fix PHPOffice#849, which went stale in 2019 and is now reopened.

Html Reader currently echoes any warning messages from Dom::loadHtml when it parses Html input. These are generally not needed, and may cause PhpSpreadsheet to fail needlessly. A new property `$suppressLoadWarnings` is added. It will additionally default to `null`, which will avoid any BC breaks. However, the default will be changed to `true` in a future release. Should the caller be interested in any messages which are suppressed when `true` is in effect, these are available through new method `getLibxmlMessages` after the Html has been loaded.
@oleibman oleibman added this pull request to the merge queue Dec 29, 2025
Merged via the queue into PHPOffice:master with commit d53a8e5 Dec 29, 2025
15 checks passed
@oleibman oleibman deleted the htmlwarn branch December 29, 2025 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

PhpSpreadsheet fails in DOMDocument::loadHTML() when using ASIDE tag. Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

1 participant