Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.75k stars 885 forks source link

After update to 14.6.1, PHP Fatal error: Uncaught Error: Class 'Yoast\\WP\\SEO\\Integrations\\XMLRPC' not found #15726

Open kstarcher opened 4 years ago

kstarcher commented 4 years ago

After updating to 14.6.1, my local still works, but pushing to the dev site on WP Engine causes a fatal error. Same plugins and versions are in place in both environments.

– I tried deleting Yoast and reinstalling from scratch, but the problem persists. – I tried deactivating all plugins, but activating Yoast again caused the crash. – The theme is a custom theme – updating Yoast on a barebones install with just that theme and the other plugins in place did not cause an error, so the theme is not causing the conflict. – I can’t give the URL out in a public environment, but if there is a private support ticket option, I can tell you more. – I see that a hotfix related to XMLRPC was released two days ago as per this issue: https://github.com/Yoast/wordpress-seo/issues/15694 Might it have broken something else in turn?

The error is:

[Thu Jul 23 21:40:04.472648 2020] [php7:error] [pid 20859] [client 97.107.188.94:25126] PHP Fatal error: Uncaught Error: Class ‘Yoast\WP\SEO\Integrations\XMLRPC’ not found in /nas/content/live/sitefolderhere/wp-content/plugins/wordpress-seo/src/loader.php:233\nStack trace:\n#0 /nas/content/live/sitefolderhere/wp-content/plugins/wordpress-seo/src/loader.php(202): Yoast\WP\SEO\Loader->conditionals_are_met(‘Yoast\\WP\\SEO\\In…’)\n#1 /nas/content/live/sitefolderhere/wp-includes/class-wp-hook.php(287): Yoast\WP\SEO\Loader->load_integrations(”)\n#2 /nas/content/live/sitefolderhere/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)\n#3 /nas/content/live/sitefolderhere/wp-includes/plugin.php(478): WP_Hook->do_action(Array)\n#4 /nas/content/live/sitefolderhere/wp-settings.php(540): do_action(‘init’)\n#5 /nas/content/live/sitefolderhere/wp-config.php(125): require_once(‘/nas/content/li…’)\n#6 /nas/content/live/sitefolderhere/wp-load.php(37): require_once(‘/nas/content/li…’)\n#7 /nas/content/live/sitefolderhere/wp-admin/admin.php(34): require_once(‘/nas/content/li…’)\n#8 /nas/content/live/sitefolderhere/wp-admin/plugins.php(10): req in /nas/content/live/sitefolderhere/wp-content/plugins/wordpress-seo/src/loader.php on line 233, referer: https://sitefolderhere.wpengine.com/wp-admin/plugins.php

Thank you!

Djennez commented 4 years ago

This sounds like an incomplete installation, please make sure that you manually remove the plugin folder from the intended use location (via (s)FTP or SSH or whichever preferred method, just not with an online management tool) and manually upload the latest version (again via a file transfer, not an online tool).

kstarcher commented 4 years ago

Whaddya know, that did the job, and I can confirm it's working now. Thank you! This isn't something I've run into before, though, so I'm perplexed. Any idea why a git add + commit + push of a fresh local installation might have failed, and how I can avoid that happening again? I pushed a few other plugins at the same time which don't seem to have caused any issues.

Djennez commented 4 years ago

I said it looked like an incomplete installation, but it might as well have been OPcaching I think. While pushing the files it may have either:

I think both of these might be able to trigger this error. And both of these may have been solved by completely wiping the files and replacing them. I don't know if you're running OPCache on your server, but if this happens again you may be able to narrow the cause down to just flushing OPCache (restarting the PHPProcess often does the trick) and see if the issue is fixed. If it is: you know it's the cache and you can include a cache flush in your normal deployment. If it didn't fix the issue, it may be a faulty overwrite of the files and you might need to do some additional debugging into why that happened.

Can you close this issue if you agree that it's solved? :)

kstarcher commented 4 years ago

I can indeed! And thanks very much for the extra info, that's very useful and great to know if this comes up again.

DrizzlyOwl commented 4 years ago

Hello, I'm reopening this issue as I am also experiencing this exact error.

The plugin was updated on a local development (MAMP) environment, using the standard WordPress Plugin updater with the admin area.

The changed files were then committed and pushed to Git. Our deployment tool then cloned the repository down on the webserver.

I followed the advice of clearing OPCache (via restarting Apache) but the error still presented itself.

I removed the wordpress-seo plugin folder from the web server filesystem using rm -r wordpress-seo and that allowed me to access the website.

Back on a local environment, i deleted the plugin from the local filesystem, removed it from Git entirely and tried to reinstall it via the WordPress Plugin Library. Clicking install within the Plugin Library for Yoast SEO. After deploying this version of the plugin, I restarted the Apache service, but the error still persisted.

I also tried to download a fresh plugin zip from https://en-gb.wordpress.org/plugins/wordpress-seo/ rather than use the WordPress Admin Plugin Library but this was also unsuccessful.

Keen to hear if you have any other suggestions on how I might fix this

Warning: include(/path/to/document/root/content/plugins/wordpress-seo/vendor/composer/../../src/integrations/xmlrpc.php): failed to open stream: No such file or directory in /path/to/document/root/content/plugins/wordpress-seo/vendor/composer/ClassLoader.php on line 444

Warning: include(): Failed opening '/path/to/document/root/content/plugins/wordpress-seo/vendor/composer/../../src/integrations/xmlrpc.php' for inclusion (include_path='.:/usr/share/php') in /path/to/document/root/content/plugins/wordpress-seo/vendor/composer/ClassLoader.php on line 444

Fatal error: Uncaught Error: Class 'Yoast\WP\SEO\Integrations\XMLRPC' not found in /path/to/document/root/content/plugins/wordpress-seo/src/loader.php:233 Stack trace: #0 /path/to/document/root/content/plugins/wordpress-seo/src/loader.php(202): Yoast\WP\SEO\Loader->conditionals_are_met('Yoast\\WP\\SEO\\In...') #1 /path/to/document/root/wordpress/wp-includes/class-wp-hook.php(287): Yoast\WP\SEO\Loader->load_integrations('') #2 /path/to/document/root/wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array) #3 /path/to/document/root/wordpress/wp-includes/plugin.php(478): WP_Hook->do_action(Array) #4 /path/to/document/root/wordpress/wp-settings.php(540): do_action('init') #5 /path/to/document/root/wp-config.php(45): in /path/to/document/root/content/plugins/wordpress-seo/src/loader.php on line 233
kstarcher commented 4 years ago

And just to follow up, I have since updated Yoast to 14.6.1 on 3 more sites, and one of them also failed in the same way and had to be updated via FTP. These are all on WP Engine hosting if that helps diagnose anything.

DrizzlyOwl commented 4 years ago

Hello, I have successfully located the source of the issue.

In the wordpress-seo/src/integrations/ folder there is an xmlrpc.php.

xmlrpc.php is a file that comes baked into WordPress core and on poorly configured web hosts could allow for possible malicious attack vectors.

In an effort to mitigate this, projects created using wp-deploy (such as ours) have a line in the .gitignore which is an attempt at preventing the WordPress xmlrpc.php from being included in version control.

Typically though; if you use wp-deploy correctly, you would have never included the WordPress source code in your Git repository as WordPress is brought in as a Git submodule which makes this line effectively redundant.

If you are checking WordPress core into your Git repository, you can change the line to /wordpress/xmlrpc.php to make the gitignore rule more specific. (Omit /wordpress if you have WordPress core in the root of your project instead of a subdirectory)

Some of you (@kstarcher), may well also have a .gitignore_global file on your system which may contain the line xmlrpc.php too. Again, you can either remove the line or make it more specific as mentioned above.

Once you have made this change, you will notice a new file appears as an untracked change within Yoast plugin. Commit, push and deploy and the plugin will work.

Djennez commented 4 years ago

@DrizzlyOwl fantastic finding, this might indeed be the issue that people are having. Hopefully some people having this issue are able to confirm / deny this.

Pinging @herregroen because we might need to rethink the naming of this item if this is indeed the issue.

mattkeys commented 4 years ago

I can confirm that I was having this issue, and this fixed it.

Djennez commented 4 years ago

Reopening this to make sure this gets seen and possibly fixed.

cresharper commented 3 years ago

I'm experiencing this exact issue now

Wordpress Version: 5.6.2 PHP version: 7.3 Yoast SEO version: 14.4.1

I did a deployment of two files (a page template, and an ACF json snippet) and everything just kind of...fell apart? Now when that plugin is enabled it just completely crashes everything.

Whenever I try to hit any post type or pages editor in the backend it blows up.

The error in question:

Fatal error: Uncaught Error: Class 'WP_REST_Application_Passwords_Controller' not found
in /nas/content/live/site/wp-includes/rest-api.php on line 269

Call stack:

create_initial_rest_routes()
wp-includes/class-wp-hook.php:287
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:311
WP_Hook::do_action()
wp-includes/plugin.php:484
do_action()
wp-includes/rest-api.php:521
rest_get_server()
wp-content/plugins/wordpress-seo-premium/inc/class-wpseo-utils.php:1052
WPSEO_Utils::are_content_endpoints_available()
wp-content/plugins/wordpress-seo-premium/premium/classes/premium-metabox.php:175
WPSEO_Premium_Metabox::get_rest_api_config()
wp-content/plugins/wordpress-seo-premium/premium/classes/premium-metabox.php:97
WPSEO_Premium_Metabox::send_data_to_assets()
wp-content/plugins/wordpress-seo-premium/premium/classes/premium-metabox.php:83
WPSEO_Premium_Metabox::enqueue_assets()
wp-includes/class-wp-hook.php:287
WP_Hook::apply_filters()
wp-includes/class-wp-hook.php:311
WP_Hook::do_action()
wp-includes/plugin.php:484
do_action()
wp-admin/admin-header.php:102
require_once()
wp-admin/edit.php:394
cresharper commented 3 years ago

If anyone stumbles on this and has this issue, update all your core files minus wp-content from wordpress.org and it should be fine.