PHP 8.0 Deprecated message for params of function getUsers()
-
Hello there,
I’ve just come across a very simple issue to fix when running WP Remote under a PHP 8.0 installation:
PHP Deprecated: Required parameter $full follows optional parameter $args in [redacted]/wp-content/plugins/wpremote/callback/wings/info.php on line 159
Besides that warning, everything works precisely as it should. The only issue I’ve got with deprecated warnings is that today they are warnings, tomorrow they become fatal errors (PHP maintenance is tough!).
So, because, PHP 8.0 is a bit stricter on syntax in general, we ought to fix this permanently; on line 159 we can see the declaration of
getUsers()
:public function getUsers($args = array(), $full) {
Under PHP 8.0, you cannot have function parameters with default values before one without defaults; in other words, as soon as one parameter has a default value, all others after that one must have default values, too, for example:
public function getUsers($args = array(), $full = '') {
This will get rid of the warning message, but I’d like the developers to double-check if it makes sense in the context that this function gets called…
- The topic ‘PHP 8.0 Deprecated message for params of function getUsers()’ is closed to new replies.