Yoast / wordpress-seo

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

Major bug preventing indexing in Yoast #20198

Closed zoddshop closed 1 year ago

zoddshop commented 1 year ago

I have reset indexing over 10 times and the same error always occurs when re-indexing. I've tried both wp-cli and the gui. There is a confirmed bug I am experiencing where the yoast indexing process is causing a fatal error.

[STDERR] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /usr/local/lsws/Example/html/wordpress/wp-includes/formatting.php:3443
Stack trace:
#0 /usr/local/lsws/Example/html/wordpress/wp-includes/class-wp-hook.php(308): convert_smilies()
#1 /usr/local/lsws/Example/html/wordpress/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#2 /usr/local/lsws/Example/html/wordpress/wp-content/plugins/wordpress-seo/src/builders/indexable-link-builder.php(115): apply_filters()
#3 /usr/local/lsws/Example/html/wordpress/wp-content/plugins/wordpress-seo/src/actions/indexing/abstract-link-indexing-action.php(65): Yoast\WP\SEO\Builders\Indexable_Link_Builder->build()
#4 /usr/local/lsws/Example/html/wordpress/wp-content/plugins/wordpress-seo/src/routes/abstract-indexation-route.php(24): Yoast\WP\SEO\Actions\Indexing\Abstract_Link_Indexing_Action->index()
#5 /usr/local/lsws/Example/html/wordpress/wp-content/plugins/wordpress-seo/src/routes/indexing-route.php(418): Yoast\WP\SEO\Routes\Abstract_Indexation_Route->run_indexation_action()
#6 /usr/local/lsws/Example/html/wordpress/wp-content/plugins/wordpress-seo/src/routes/indexing-route.php(354): Yoast\WP\SEO\Routes\Indexing_Route->run_indexation_action()
#7 /usr/local/lsws/Example/html/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1181): Yoast\WP\SEO\Routes\Indexing_Route->index_post_links()
#8 /usr/local/lsws/Example/html/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1028): WP_REST_Server->respond_to_request()
#9 /usr/local/lsws/Example/html/wordpress/wp-includes/rest-api/class-wp-rest-server.php(442): WP_REST_Server->dispatch()
#10 /usr/local/lsws/Example/html/wordpress/wp-includes/rest-api.php(410): WP_REST_Server->serve_request()
#11 /usr/local/lsws/Example/html/wordpress/wp-includes/class-wp-hook.php(308): rest_api_loaded()
#12 /usr/local/lsws/Example/html/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#13 /usr/local/lsws/Example/html/wordpress/wp-includes/plugin.php(565): WP_Hook

[STDERR] ->do_action()
#14 /usr/local/lsws/Example/html/wordpress/wp-includes/class-wp.php(399): do_action_ref_array()
#15 /usr/local/lsws/Example/html/wordpress/wp-includes/class-wp.php(780): WP->parse_request()
#16 /usr/local/lsws/Example/html/wordpress/wp-includes/functions.php(1334): WP->main()
#17 /usr/local/lsws/Example/html/wordpress/wp-blog-header.php(16): wp()
#18 /usr/local/lsws/Example/html/wordpress/index.php(17): require(‘…’)
#19 {main}
thrown in /usr/local/lsws/Example/html/wordpress/wp-includes/formatting.php on line 3443

Here is the relevant lines of formatting.php

function convert_smilies( $text ) {
global $wp_smiliessearch;
$output = ”;
if ( get_option( ‘use_smilies’ ) && ! empty( $wp_smiliessearch ) ) {
// HTML loop taken from texturize function, could possible be consolidated.
$textarr = preg_split( ‘/(<.*>)/U’, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // Capture the tags as well as in between.
$stop = count( $textarr ); // Loop stuff.

There was also a thread here regarding this https://wordpress.org/support/topic/seo-optimization-not-working-after-wordpress-upgrade/

monbauza commented 1 year ago

Thanks for submitting a bug report for the Yoast SEO plugin, @zoddshop. Unfortunately, we've been unable to reproduce it in our testing environment.

Looking at the error details, the error seems to occur because preg_split returns an unexpected value (bool) in the convert_smilies WordPress function. We suspect the problem is specific to the content of one of your posts, pages, categories, etc. as we couldn't reproduce it on our end.

If you inspect the network tab in the browser's console while you run the SEO data optimization, you'll view the objects that Yoast SEO is analyzing. This may help you identify what exact object the optimization is failing (see screenshot below). Once you identify the relevant object, you can open the edit screen of the object (i.e. post, page, etc.) and check whether the same error also occurs and whether there's something 'strange' in the content of that object that may be causing an error in the convert_smilies WordPress function.

Based on our investigations and taking into account that we can't reproduce the bug, we're closing the report for now. Feel free to post a comment with additional information. If we are provided with detailed steps that allow us to reproduce the problem, we'll consider re-opening the report.

Thanks!

image

zoddshop commented 1 year ago

It does not show anything related to a post.

Console Shows-

FetchEvent for "/wp-json/yoast/v1/link-indexing/posts" resulted in a network error response: a Response whose "body" is locked cannot be used to respond to a request.

Network Tab Shows-

POST /wp-json/yoast/v1/link-indexing/posts Status Code 500 strict-origin-when-cross-origin

General GET /wp-json/yoast/v1/indexing/general Status Code 404 strict-origin-when-cross-origin

Why is a convert smilies function stopping yoast from proceeding? Is there a workaround?

zoddshop commented 1 year ago

Holdon firefox showed me some more details here

GET wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data Status 403 Forbidden Firefox can’t establish a connection to the server at wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data

POST wp-json/yoast/v1/link-indexing/posts Status 500 Internal Server Error

zoddshop commented 1 year ago

Please reopen this as this is a bug in Yoast. I checked and all the responses from the post requests during indexing now say

{"objects":[],"next_url":false}

You guys could also add more console logging because there is no way to tell if a specific post is causing the problem.

monbauza commented 1 year ago

Hi @zoddshop! To reopen the report and consider it as a bug, we should be able to reproduce it. Unfortunately, we're still unable to do so with the provided information.

As further troubleshooting steps, you may try resetting the internal link counter, prominent words calculation and indexables tables using the Yoast Test Helper plugin. Then, run the SEO data optimization, inspect the network tab in the browser's console and check what object IDs were processed before the optimization fails. This may help you track down what object causes the optimization to fail.