Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of undefined constant LIBXML_HTML_NODEFDTD warning shown in some environments #25122

Closed
ghost opened this issue Sep 7, 2020 · 8 comments
Closed
Labels
[Type] Bug An existing feature does not function as intended

Comments

@ghost
Copy link

ghost commented Sep 7, 2020

After the Gutenberg update two days ago (one before last) The following WARNING appeared at the top of the Home page of my website:

Warning: Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' (this will throw an Error in a future version of PHP) in /var/www/wp-content/plugins/gutenberg/lib/block-supports/index.php on line 64

Warning: A non-numeric value encountered in /var/www/wp-content/plugins/gutenberg/lib/block-supports/index.php on line 64

LINE 64 is a var about GMEDIA. Therefore I immediately contacted GMedia....

RATTUS at GMedia wrote about the error message:: "**That is impossible that in /wp-content/plugins/gutenberg/lib/block-supports/index.php on line 64 was var about Gmedia plugin because it's completely different plugin. Also there is no any constant with name LIBXML_HTML_NODEFDTD in Gmedia Gallery plugin.

You need to ask Gutenberg developers about your problem because error is in their plugin."**

I am posting a Virtual Art Exhibit tomorrow and need immediate resolution to the issue.
PLEASE HELP!!!!
THANK YOU SO MUCH!!!

@skorasaurus
Copy link
Member

skorasaurus commented Sep 7, 2020

Hi,

Note: I am not 100% sure whether this advice will work. If you have a critical issue like this, I would highly recommend hiring or website developer and/or WordPress consultant.

To immediately solve the issue for your exhibit tomorrow, you'll need to use a previous version of Gutenberg.
You can temporarily roll back to a previous version of the Gutenberg plugin by using another free plugin WP-Rollback. If this doesn't work, I would recommend to 'roll back' any other plugins you recently updated or contact your webhost provider.

For the long-term, the error message leads me to believe appears that your website maybe using an old version of PHP, a programming language that is installed on your website and is used by WordPress. The version of php used for your website is not controlled by WordPress, it is provided by your website host.

You can check the php version through WordPress by visiting http://nameofyourwebsite.com/wp-admin/site-health.php?tab=debug and click the server tab.

If it says a number less than 7.3; then you're using an older version of PHP that is not recommended by WordPress can lead some to security issues on your website and it's more likely that you'll find errors like this on your website.

Contact your website host to change the PHP version. If you have an important event tomorrow, you should probably wait to change the PHP version until you have time devoted to this.

Note, in the future, this repository is typically for very advanced issues relating to Gutenberg and it's expected that participants have a relatively high level of technical experience. In the future, first try the WordPress support forums or contact a WordPress consultant or web developer.

@ghost
Copy link
Author

ghost commented Sep 7, 2020 via email

@talldan talldan added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Sep 8, 2020
@talldan
Copy link
Contributor

talldan commented Sep 8, 2020

@talldan talldan changed the title Gutenberg update generated invalid error for Gmedia - URGENT!!!!!! HELP REQUESTED!!! Use of undefined constant LIBXML_HTML_NODEFDTD warning shown in some environments Sep 8, 2020
@ReisingerWolfgang
Copy link

I have a similar error but in line 66 after upgrade to new WP and Gutenberg version....

Warning: Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' (this will throw an Error in a future version of PHP) in .../web/WPVB/wp-content/plugins/gutenberg/lib/block-supports/index.php on line 66 Warning: A non-numeric value encountered in .../web/WPVB/wp-content/plugins/gutenberg/lib/block-supports/index.php on line 66

Line 66 in Code:
$success = $dom->loadHTML( $wrapped_block_html, LIBXML_HTML_NODEFDTD | LIBXML_COMPACT );

Wordpress: 5.5.1
PHP: 7.3.21
Gutenberg: 8.9.2

@tellthemachines tellthemachines added [Type] Bug An existing feature does not function as intended and removed [Type] Help Request Help with setup, implementation, or "How do I?" questions. labels Oct 14, 2020
@getsource
Copy link
Member

We talked about this in today's dev meeting:
https://wordpress.slack.com/archives/C02RQBWTW/p1602652885487500

Tests started failing on GoDaddy and AMIMOTO around when r49135 landed.

@talldan pointed out https://github.com/WordPress/gutenberg/blob/master/lib/block-supports/index.php#L66, which matches with the timeline due to the block-supports merge included in r49135.

The full test results can be found linked in the host names above, but it's 24 test failures -- here's the first one:

WP_Block_Context_Test::test_provides_block_context
Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' (this will throw an Error in a future version of PHP)

/tmp/wp-test-runner/build/wp-includes/block-supports/index.php:73
/tmp/wp-test-runner/build/wp-includes/class-wp-hook.php:287
/tmp/wp-test-runner/build/wp-includes/plugin.php:206
/tmp/wp-test-runner/build/wp-includes/class-wp-block.php:237
/tmp/wp-test-runner/build/wp-includes/class-wp-block.php:211
/tmp/wp-test-runner/build/wp-includes/blocks.php:721
/tmp/wp-test-runner/tests/phpunit/tests/blocks/block-context.php:132

I'll add additional hosts as well, if I find them when looking through the results.

Will reach out to GoDaddy about the version of libxml, too, to see whether it's a custom compile as mentioned in this PR or not.

I noticed that both hosts in question have redhat notes in the environment info reported, so this makes me think it might be a standard CentOS package.

Either way, since there are two hosts with this issue that we know of already, I think it'd be a good idea to fix / add backcompat for this for 5.6, since there are likely others on the long tail.

getsource added a commit to getsource/gutenberg that referenced this issue Oct 16, 2020
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.
@getsource
Copy link
Member

getsource commented Oct 16, 2020

Added PR #26210 that looks to solve the issue with the code in the appropriate location on the core side in the GoDaddy test environment.

It's a port from https://github.com/ampproject/amp-wp/pull/4486/files, which @talldan mentioned above.
The amp-wp plugin is GPL v2: https://github.com/ampproject/amp-wp/blob/develop/LICENSE

@getsource
Copy link
Member

After #26192, this code isn't in the project anymore.

This looks to be solved in core now, when merged in https://core.trac.wordpress.org/changeset/49226

It's passing in tests at both GoDaddy and AMIMOTO now.

For anyone coming across this ticket later, libxml2 2.7.6-21 is the newest version of libxml available for CentOS 6, which is supported until the end of November (2020).

Recommend closing the issue.

@talldan
Copy link
Contributor

talldan commented Oct 21, 2020

Thanks @getsource for looking into the issue!

@talldan talldan closed this as completed Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

5 participants