This problem is bad code in their plugin.
I have found that when you deactivate it and reactivate it you will see these entries in the logs.
The offending line of code is $test[[‘test’] which is inside an sprintf method. The %s is expecting a STRING value in the statement below:
$function = sprintf(
'get_test_%s',
$test['test']
);
However, $test[test] is an Array object that looks like this:
[test] => Array (
[0] => Health_Check_Site_Status Object
(
[mysql_min_version_check:Health_Check_Site_Status:private] => 1
[mysql_rec_version_check:Health_Check_Site_Status:private] => 1
[is_mariadb] => 1
[mysql_server_version:Health_Check_Site_Status:private] => 10.3.23-MariaDB-log-cll-lve
[health_check_mysql_required_version:Health_Check_Site_Status:private] => 5.5
[health_check_mysql_rec_version:Health_Check_Site_Status:private] => 10.0
)
[1] => get_test_timezone_not_utc
)
My guess is that they are attempting to print out get_test_timezone_not_utc (or whatever test it is running. However if they attempt to just pull that from the data then this line:
'get_test_%s',
would result in get_test_get_test_timezone_not_utc
So I THINK the fix is to replace
$function = sprintf(
'get_test_%s',
$test['test']
);
with
$function = sprintf(
'%s',
$test['test'][1]
);
But this reveals another code issue at line 2020
} else {
$results[] = call_user_func( $test['test']);
}
which I attempted to fixed by adding the [1] to get the test name.
} else {
$results[] = call_user_func( $test['test'][1] );
}
HOWEVER, whoever coded this still has old data model mixed in with the new data model, and there are tests which are NOT arrays, like the rest of the data model.
eg: ‘loopback_requests’ and ‘dotorg_communication’
So their code needs some work, because $test[‘test’] has two differing data structures.
EDIT:
Here is how I fixed this for each block in my version of their plugin file class-health-check-site-status.php. It gets rid of the debug log errors… God only knows if it fixes their plugin though…
foreach ( $tests as $test ) {
if (is_array($test['test'])) {
$function = sprintf(
'%s',
$test['test'][1]
);
} else {
$function = sprintf(
'get_test_%s',
$test['test']
);
}
if ( method_exists( $this, $function ) && is_callable( array( $this, $function ) ) ) {
$results[] = call_user_func( array( $this, $function ) );
} else {
if (is_array($test['test'])) {
$results[] = call_user_func( $test['test'][1] );
} else {
$results[] = call_user_func('get_test_' . $test['test']);
}
}
}