Yoast / wordpress-seo

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

Yoast causes critical error #15572

Open holydoji opened 4 years ago

holydoji commented 4 years ago

Please give us a description of what happened.

Yoast SEO makes my WooCommerce-Dashboard (Marketing, Products …) and other backend-pages like Learndash-Builder being broke. As soon as Yoast is activated, woo dashboard is not loading anymore. Therefore I get a daily Wp-mail stating that Yoast SEO has a problem with the page: https://bit.ly/3dQ3TlI

----> There is a very in depth explanation for the problem: I have checked this issue in depth and it is not caused by our Gamipress leaderboards add-on. It is caused by Yoast SEO. WooCommerce has a REST API reports named “leaderboard”, if any plugin registers a post type with the name “leaderboard”, Yoast SEO tries to work with the WooCommerce leaderboard like a post type endpoints And here is when the issue comes, since the responses from the WooCommerce rest API are not related to the post type leaderboard. You can check that this issue doesn’t comes from our add-on by deactivating it and registering the post type “leaderboard” by yourself (or using the CPT UI plugin) So is the Yoast SEO team who needs to prevent to work with the WooCommerce leaderboards endpopints when the post type “leaderboard” is registered in the site

SEE support forum: https://wordpress.org/support/topic/yoast-breaks-woo-dashboard/#post-12999515

Please describe what you expected to happen and why.

It should not crash my backend.

How can we reproduce this behavior?

  1. Install my plugins: https://i.imgur.com/v1lcFbG.png (all plugins have been updated, not like in the screenshot) and it will crash.

Technical info

All Plugins and themes have been updated.

Used versions

Djennez commented 4 years ago

I was able to reproduce this.

To reproduce:

This is due to this line in core class-wp-rest-controller.php:

$prepared[ $field_name ] = call_user_func( $field_options['get_callback'], $prepared, $field_name, $request, $this->get_object_type() );

This will call the for_post() function found here: https://github.com/Yoast/wordpress-seo/blob/a30a8cc8fdccccac226d2fb7254ef13f730345b7/src/routes/yoast-head-rest-field.php#L97-L112

But instead of an array of request parameters it will receive another object which causes a fatal error.

amboutwe commented 4 years ago

Please inform the customer of conversation # 627679 when this conversation has been closed.

amboutwe commented 4 years ago

@holydoji A potential workaround based on the information above is to disable the Yoast REST API: Head endpoint. Please go to Admin > SEO > General > Features and toggle the 'REST API: Head endpoint' to 'Off'. As this may have an impact on certain site setups, I'd recommend testing this workaround on a staging site before applying to your live production site.

priyabirdie commented 4 years ago

I'm not sure where to put this bug report for Yoast SEO free version. I just started my blog, and this plug in was creating a problem with my site. It did not allow the categories in my site to show the different posts in that category. When I clicked on a category, I received a blank screen. After I disabled Yoast SEO free version, this problem was solved. I really liked using Yoast for SEO.

holydoji commented 4 years ago

Thanks, amboutwe. That workaround is working. Thank you very much. But will the bug ever been corrected? What is the disadvantage of having the REST API turned off?

Djennez commented 4 years ago

~After investigating this, I found that this issue is not caused by us but by the WooCommerce Admin plugin. I have reported this with them here. Please monitor that thread for updates as I will be closing this one.~

Needs more investigation

Pcosta88 commented 4 years ago

Please inform the customer of conversation # 641278 when this conversation has been closed.

Djennez commented 3 years ago

Internal issue created here (restricted).

Pcosta88 commented 3 years ago

Users will sometimes get an email from WordPress saying

CRITICAL Uncaught Error: Cannot use object of type stdClass as array

sjoerdlo commented 2 years ago

This also happens with taxonomies. When I create a taxonomy with id 'theme' I get:

Notice: Undefined index: id in wp-content/plugins/wordpress-seo/src/routes/yoast-head-rest-field.php on line 147

Disabling the Yoast REST API: Head endpoint works here as well.

Related: #15559