Classicpress-seo causes http 500 errors || Upgrade API does not respond

Unable to login to backend, Got Error 500

Tried to login, got white screen and Error 500 in response.

Found this in the Server Logs

[Thu Nov 09 12:58:40.817002 2023] [-:error] [pid 64148:tid 34423624960] [client 142.54.169.133:53768] FastCGI: server “/var/run/hcgi/530” stderr: PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home//www//wp-content/plugins/classicpress-seo/includes/class-update-client.php:872

Deleted the Plugin classicpress-seo and then i was able to login. Try to install the plugin again.

ClassicPress 1.7.1
PHP 8.0.30

Installed latest version 2.2.0 of the plugin. Pushed the button to activate the plugin, then:

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php:872 Stack trace: #0 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php(872): count(NULL) #1 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php(112): Classic_SEO\UpdateClient\UpdateClient->get_latest_version_number() #2 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php(135): Classic_SEO\UpdateClient\UpdateClient->__construct() #3 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php(902): Classic_SEO\UpdateClient\UpdateClient::get_instance() #4 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/classicpress-seo.php(267): require_once(‘/home/simworld/…’) #5 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/classicpress-seo.php(183): Classic_SEO->includes() #6 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/classicpress-seo.php(165): Classic_SEO->setup() #7 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/classicpress-seo.php(430): Classic_SEO::get() #8 /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/classicpress-seo.php(434): cpseo() #9 /home/simworld/www/simsi-photography/wp-admin/includes/plugin.php(2138): include(‘/home/simworld/…’) #10 /home/simworld/www/simsi-photography/wp-admin/plugins.php(176): plugin_sandbox_scrape(‘classicpress-se…’) #11 {main} thrown in /home/simworld/www/simsi-photography/wp-content/plugins/classicpress-seo/includes/class-update-client.php on line 872

Same with Version 2.1.3 and 2.1.1

Updated PHP to 8.1.25 same issue

Seems like the API does not respond…

// Make a request to the ClassicPress versions API.
$response = wp_remote_get('https://api-v1.classicpress.net/upgrade/index.php', ['timeout'=>3]);

// Problems? Bail.
if (is_wp_error($response) || empty($response)) {
	return;
}

// Get decoded reponse.
$versions = json_decode(wp_remote_retrieve_body($response));

// Reverse iterate to find the latest version.
for ($i=count($versions)-1; $i>0; $i--) {
	if (!strpos($versions[$i], 'nightly')) {
		if (!strpos($versions[$i], 'alpha')) {
			if (!strpos($versions[$i], 'beta')) {
				if (!strpos($versions[$i], 'rc')) {
					$version = $versions[$i];
					break;
				}
			}
		}
	}
} // At this point, $version = 1.1.1.json

@MattyRob any idea mate what causes this peculiar behavior? :thinking:

Seems like the $response is the problem which causes the null problem with $versions inside count().

Now, my turn to ask: what are we supposed to get as a response from https://api-v1.classicpress.net/upgrade/index.php?

I’m asking because I get this error:

Based on https://github.com/ClassicPress/ClassicPress-APIs/blob/bdba1c9c5059de6bf2b9b9b510cb39487189e1de/v1/upgrade/index.php, what we supposed to see is two options: if it’s a browser call, we should get a list of API responses, else it should return the output in a JSON format.

Please correct me wherever I’m wrong because I’ve got confused too here.

As I see it, everyone who uses classicpress-seo currently has this problem.

I have confirmed my finding with the help of var_dump() and indeed it produces the same aforementioned 404 error while fetching it with wp_remote_get().

What confused me with the code snippet I shared above is this portion of code:

// Problems? Bail.
if (is_wp_error($response) || empty($response)) {
	return;
}

The first part is supposedly catching the error here…but if we follow the code, we see

// Get decoded reponse.
$versions = json_decode(wp_remote_retrieve_body($response));

which by looking the implementation of wp_remote_retrieve_body(), we see also

function wp_remote_retrieve_body( $response ) {
	if ( is_wp_error( $response ) || ! isset( $response['body'] ) ) {
		return '';
	}

	return $response['body'];
}

which again uses is_wp_error()…I have no idea how ClassicPress or WordPress code works, seriously now!

same problem is also mentioned here: Can't activate V 2.2.0 because of Fatal error · Issue #166 · ClassicPress/classicpress-seo · GitHub

Hallo,

have a similar problem.

Possibly because I activated redirections and sitemaps two days ago (I did this a long time ago, but had problems then too - then switched to manually creating the sitemap).

Now how can I disable redirections and/or sitemaps without access? I renamed the plugin via ftp, and then I can get into the backend - but if I rename the plugin again, I lose access again.

Thanks for help!

Greetings

As in this topic seems that UpdateClient.class.php is breaking if api-v1.classicpress.net returns an unexpected response.

There seems to be an issue with the Classicpress-SEO plugin. I have not tried to upgrade to the new CP version, but my site was down today.

Tech sent this message:

It was being cased by the classicpress seo plugin on the site causing a fatal php error.

The hosting company deactivated it and it’s working fine now.

May be worth logging in to see if it needs updating and I would also reach out to the plugin developer.

I don’t see any updates for that plugin.

Hello,

I activated the redirects and sitemaps in the plugin on two pages… they no longer work or only work when the plugin is deactivated.

On another page I have not activated the redirects and sitemaps… everything works correctly there (even if cpseo is otherwise activated…).

Is there a way to deactivate the redirects and/or sitemaps without access? I think that the other two pages would then work again… or is there a way to enable meta title and description somehow?

Thanks for help!

p.s.: this is the error-message:

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in …/wp-content/plugins/classicpress-seo/includes/class-update-client.php:872 Stack trace: #0 …/wp-content/plugins/classicpress-seo/includes/class-update-client.php(872): count() #1 …/wp-content/plugins/classicpress-seo/includes/class-update-client.php(112): Classic_SEO\UpdateClient\UpdateClient->get_latest_version_number() #2 …/wp-content/plugins/classicpress-seo/includes/class-update-client.php(135): Classic_SEO\UpdateClient\UpdateClient->__construct() #3 …/wp-content/plugins/classicpress-seo/includes/class-update-client.php(902): Classic_SEO\UpdateClient\UpdateClient::get_instance() #4 …/wp-content/plugins/classicpress-seo/classicpress-seo.php(267): require_once(‘/homepages/23/d…’) #5 …/wp-content/plugins/classicpress-seo/classicpress-seo.php(183): Classic_SEO->includes() #6 …/wp-content/plugins/classicpress-seo/classicpress-seo.php(165): Classic_SEO->setup() #7 …/wp-content/plugins/classicpress-seo/classicpress-seo.php(430): Classic_SEO::get() #8 …/wp-content/plugins/classicpress-seo/classicpress-seo.php(434): cpseo() #9 …/wp-admin/includes/plugin.php(2326): include_once(‘/homepages/23/d…’) #10 …/wp-admin/plugins.php(192): plugin_sandbox_scrape() #11 {main} thrown in …/wp-content/plugins/classicpress-seo/includes/class-update-client.php on line 872

We are working on getting the API server back up and running - ran in to some major problems as the base software was very out of date. It seems the is causing the issue.

[Update] - the API is working again as far was we can test so this issue should resolve.

4 Likes

Thanks!!!

Everything works again!!!

Thanks!!!

Thanks!!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.