I could confirm this.
Got the same message.
I’ve investigate the source code and found the reason.
The variable parts is created by the function parse_url (@see https://php.net/parse_url)
by using the variable $referred wihich is filled by the method get_Referred of the class WP_Statistics which can be found in the subfolder includes/classes of the plugin.
If the server doesn’t send a referrer the variable $referrer is false which is the data type boolean.
To fix the issue you have to modify the code as follows:
On lines 479 – 498 of wp-content/plugins/wp-statistics/includes/classes/class-wp-statistics-hits.php:
From: `
// Loop through the SE list until we find which search engine matches.
foreach ( $search_engines as $key => $value ) {
$search_regex = wp_statistics_searchengine_regex( $key );
preg_match( ‘/’ . $search_regex . ‘/’, $parts[‘host’], $matches );
if ( isset( $matches[1] ) ) {
$data[‘last_counter’] = $WP_Statistics->Current_date( ‘Y-m-d’ );
$data[‘engine’] = $key;
$data[‘words’] = $WP_Statistics->Search_Engine_QueryString( $referred );
$data[‘host’] = $parts[‘host’];
$data[‘visitor’] = $wpdb->insert_id;
if ( $data[‘words’] == ‘No search query found!’ ) {
$data[‘words’] = ”;
}
$wpdb->insert( $wpdb->prefix . ‘statistics_search’, $data );
}`
To:
if(is_array($parts) && array_key_exists('host',$parts)){
// Loop through the SE list until we find which search engine matches.
foreach ( $search_engines as $key => $value ) {
$search_regex = wp_statistics_searchengine_regex( $key );
preg_match( '/' . $search_regex . '/', $parts['host'], $matches );
if ( isset( $matches[1] ) ) {
$data['last_counter'] = $WP_Statistics->Current_date( 'Y-m-d' );
$data['engine'] = $key;
$data['words'] = $WP_Statistics->Search_Engine_QueryString( $referred );
$data['host'] = $parts['host'];
$data['visitor'] = $wpdb->insert_id;
if ( $data['words'] == 'No search query found!' ) {
$data['words'] = '';
}
$wpdb->insert( $wpdb->prefix . 'statistics_search', $data );
}
This condition will check if the variable $parts is an array and if so also check if the key ‘host’ is available. Only if both conditions success the code block will be executed.