• Greg

    (@thewatchman3)


    Hello,

    On every page load, I am seeing 3 instances of this error show up in my Apache error log:

    mod_fcgid: stderr: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/mydomain.com/httpdocs/wp-content/plugins/wordpress-ping-optimizer/cbnet-ping-optimizer.php on line 533

    Are you able to fix this and make the plugin more PHP 7.2 compatible?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello.

    There is a temporary way to avoid errors.
    The 533th line of cbnet-ping-optimizer.php is as follows.

    $pingCount=count($this->cbnetpo_future_pings);

    We will rewrite this to the following contents.

    $pingCount = $this->cbnetpo_future_pings ? count( $this->cbnetpo_future_pings ) : 0;

    Why do not you check it in this state?
    Since there are many reports of similar trouble, we urge the plug-in producer to respond quickly.

    Yeah this plugin throws errors in any PHP 7 or above, period. Author has not updated in over a year, which makes it unreliable especially without any new PHP support, which is mandated by WP.

    To fix this issue – which occurs in newer versions of PHP (like PHP 7.2 and PHP 7.3) – you can patch the plugin file /wordpress-ping-optimizer/cbnet-ping-optimizer.php …

    On both line 530 and line 592 of cbnet-ping-optimizer.php, replace this code:

    if (is_null($this->cbnetpo_future_pings))

    …and change it to this code:

    if (empty($this->cbnetpo_future_pings) || !is_array($this->cbnetpo_future_pings))

    And your PHP Warning should be resolved and go away.

    Hope that helps.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP 7.2 Error in the log files’ is closed to new replies.