ClassicPress and PHP 7.4 compatibility

Partially OT: but CP is PHP 7.4 compatible?

I think currently it may throw some deprecated warnings, wp 5.3 included this patchset to fix 7.4 issues, these patches are not in CP (yet?)
https://core.trac.wordpress.org/ticket/47704

edit: Actually I see there is an open issue already for this

4 Likes

We’ll need to do a new release to add full compatibility for PHP 7.4, when the GitHub issue @Pross linked to is fully resolved.

1 Like

What is the current state of PHP 7.4 compatibility?

I spotted a deprecated notice after switching to PHP 7.4:

Deprecated: implode(): Passing glue string after array is deprecated. Swap the parameters in /home/REDACTED/Sites/REDACTED/wp-includes/Requests/Transport/fsockopen.php on line 195

This is a CP 1.2.0 installation.

Weird…so far I haven’t had any warning and I use PHP 7.4.11 with XDebug and full warning messages.

Weired.
It was fixed in PR 541…
Took a quick look in one of my sites and the glue is in the right place…

Interesting, and thanks for the feedback. I downloaded a fresh copy of CP 1.2.0, used it to replace the wp-admin and wp-includes folders, and all is well.

So at some point a previous CP update failed to replace the fsockopen.php file.

I think you have detected an upgrade deficiency.

I have checked various websites I have setup locally and so far only 1 fixed the warning while upgrading; the rest retained the old syntax which is not good.

P.S.: @wadestriebel is there a particular reason why quotes are being automatically removed after publishing a reply?

Same here.
1/3 sites have the wrong file in place.
Even reinstalling from dashboard don’t fix.
Forcing an update don’t work from dashboard and from wp-cli.
File permissions are ok.

I’ve discovered another installation didn’t upgrade to CP 1.2.0 properly. The file

wp-includes/SimplePie/Parse/Date.php

was an old version with the implode function parameters in the wrong order.

Manually copying the wp-includes folder from a fresh CP zip solved it.

There seems to be a fairly fundamental problem with the CP core update process.

1 Like

Out of interest, what version of CP were you upgrading from? And was the site originally built on CP or is it a WP migration?

1 Like

I was upgrading from the previous version, and this was a site which started with CP (no WP migration). I think (but I’m not certain) that the initial install was CP 1.1.4.

2 Likes

I don’t think this is related to PHP 7.4 after all. I’ve discovered that fsockopen.php and SimplePie/Parse/Date.php don’t get updated when using PHP 7.3 either. So the problem appears to be related to the actual upgrade process rather than the version of PHP.

2 Likes

Good detective work. For my part, the site was on PHP 7.3 when created and updated to CP 1.2.0, but is now on 7.4.

1 Like

I think I might know what’s happening now.

During the update process, the “updater” compares the checksum of files in the existing installation (let’s say CP 1.1.4) with those at https://api.wordpress.org/core/checksums/1.0/?version=4.9.15&locale=en_US (locale may vary). If the checksums match, the file is ignored.

If we take fsockopen.php as an example, the copy of the file in CP 1.1.4 is the same as in WP 4.9.15 and so the checksum will also be the same.

But, if fsockopen.php has been changed since 1.1.4 - as it was in CP 1.2.0 - this change won’t be recognised, as the “upgrader” is comparing the checksums of the CP 1.1.4 version with the WP 4.9.15 version – which, as already mentioned, are identical.

So, when upgrading to CP 1.2.0, fsockopen.php is subsequently added to a “skip” list and ignored - along with several other files.

I may be miles off with this so @james will need to confirm.

5 Likes

This is something that we will be fixing ASAP. I haven’t looked in detail but this explanation makes sense to me too. Here’s a GitHub issue to coordinate the work needed to fix this: Use the correct checksums when updating · Issue #679 · ClassicPress/ClassicPress · GitHub

2 Likes