greenpeace / planet4

Built on top of Wordpress tech, Greenpeace Planet 4 powers digital platforms to engage with millions and win campaigns around the world.
https://planet4.greenpeace.org
Creative Commons Attribution Share Alike 4.0 International
64 stars 26 forks source link

Errors, perhaps from the PHP 8 switch? e.g. wp-stateless #185

Closed techieshark closed 4 months ago

techieshark commented 5 months ago

Where did you find the bug?

http://www.planet4.test/

What went wrong?

PHP deprecation errors from wp-stateless (and others)

Here's the problem:

I recently noticed (but also recently started dev work on this, so not sure if the issue is recent) that there are some errors from PHP related to deprecated functions etc, and I see this at the top of the page when viewing a homepage of a dev site (for GPAP).

For example, this error

Deprecated: Return type of wpCloud\StatelessMedia\Sync\BackgroundSync::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/wp-content/plugins/wp-stateless/lib/classes/sync/class-background-sync.php on line 429

P4 is using an outdated version - 3.2.2 - of wp-stateless:

https://github.com/greenpeace/planet4-base/blob/66df5d1876c1f135db17ffa2383d7fc2093193f4/composer.json#L178

Looks like this may be fixed in 3.2.3 ?

image

https://wordpress.org/plugins/wp-stateless/#developers

Do you have screenshots?

image

Solution

Update: just confirming that the error for wp-stateless goes away if you update to 3.4.0

comzeradd commented 5 months ago

Hey! We are in the process of upgrading wp-stateless. We had to do it after the php upgrade because the newer version was not backwards compatible with php7.4.

If you have issues working the local dev environment in the meantime you can temporarily turn WP_DEBUG off. You can create a file named .wp-env.override.json.dist and add something like this:

{
  "config": {
    "WP_DEBUG": false
  }
}