[ad_1]
WordPress 6.1
ProfilePress 4.3.1
PHP 8.1
Hi,
we are upgrading to PHP 8.1 at the moment because the PHP 7.4 security support is ending in a few days. The switch to 8.1 was successful with WordPress 6.1 so far but the only plugin left that throws an error is ProfilePress :D.
The error occurs in that file:
wp-content/plugins/wp-user-avatar/src/ShortcodeParser/Builder/FieldsShortcodeCallback.php
on line 39
if (method_exists($this->current_user, 'exists') && $this->current_user->exists()) $flag = true;
this is the error message:
TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
So it seems like $this->current_user is null at that point which throws the error. But the error is only thrown if we switch to PHP 8.1 – As soon as we switch back to 7.4 the error has gone away. Indeed method_exists() was updated in PHP8 and it now throws an error in such a case apparently.
It would be nice, if you could provide a fix for that in an upcoming version. Thank you very much.
