Search code examples
phpwordpressphp-8

WP-Statistics Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given


After updating my PHP from 7 to 8.0.1 I faced this error on Wordpress 5.3.6

The Site Is Experiencing Technical Difficulties.

After checking my email inbox I got this error:

E_ERROR at line 254 /public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Model/Version.php occured.

and the error message is:

Error Message: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Model/Version.php:254

It seems the problem is via WP-Statistics plugin but there is no update for this plugin.

So please help me.


Solution

  • I solved this problem in this way. checked Version.php file in this path:

    /public_html/wp-content/plugins/wp-statistics/includes/vendor/whichbrowser/parser/src/Model/Version.php
    

    on the live 254 I just replaced:

    $version .= implode($v, '.');
    

    to

    $version .= implode('.',$v);
    

    and the issue is fixed now and my website is running on PHP 8