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.
// 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?
Seems like the $response is the problem which causes the null problem with $versions inside count().
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
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.
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.