Skip to content

Block Supports: Avoid PHP warnings on libxml < 2.7.8#26210

Closed
getsource wants to merge 1 commit into
WordPress:masterfrom
getsource:libxml_backcompat
Closed

Block Supports: Avoid PHP warnings on libxml < 2.7.8#26210
getsource wants to merge 1 commit into
WordPress:masterfrom
getsource:libxml_backcompat

Conversation

@getsource
Copy link
Copy Markdown
Member

@getsource getsource commented Oct 16, 2020

Only include LIBXML_HTML_NODEFDTD as a loadHTML() option if it is defined.

Fix ported from the AMP WordPress Plugin:
https://github.com/ampproject/amp-wp/pull/4486/files
(amp-wp is GPLv2: https://github.com/ampproject/amp-wp/blob/develop/LICENSE)

Props @schlessera.
See #25122.

Description

Only include LIBXML_HTML_NODEFDTD as a loadHTML() option if it is defined.

How has this been tested?

  • Ran the included automated tests locally in the Gutenberg Docker environment.
  • Added this change into the equivalent current place on core, then ran the core automated tests at GoDaddy. It solves the issue with warnings there.

Types of changes

This is a bug fix to avoid PHP warnings when PHP is compiled with libxml < 2.7.8

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

Only specifies `LIBXML_HTML_NODEFDTD` when defined.

Fix ported from the AMP WordPress Plugin:
https://github.com/ampproject/amp-wp/pull/4486/files

Props @schlessera.
See WordPress#25122.

// LIBXML_HTML_NODEFDTD is only available in libxml 2.7.8+.
if ( defined( 'LIBXML_HTML_NODEFDTD' ) ) {
$options |= constant( 'LIBXML_HTML_NODEFDTD' );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just be able to use the constant at this point, we don't need to wrap it in constant().

@getsource
Copy link
Copy Markdown
Member Author

Closing this out, as it was solved in PR #26192

@getsource getsource closed this Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants