Support » Plugin: W3 Total Cache » Parameter must be an array or an object that implements Countable

  • On PHP 7.2
    i’m getting constant errors at server logs

    2018/02/14 06:02:47 [error] 667#667: *260 FastCGI sent in stderr: “PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /home/ahmed/web/example.com/public_html/wp-content/plugins/w3-total-cache/Cdn_Plugin.php on line 1222” while reading response header from upstream

Viewing 6 replies - 1 through 6 (of 6 total)
  • seem to be PHP 7.2 related error, downgrade to 7.0

    My error_log has 100’s of these errors in PHP7.2 from WTC Total Cache Version 0.9.6 on WordPress 4.9.5 running Twenty Seventeen theme.

    PHP Warning: count(): Parameter must be an array or an object that implements Countable in example.com/wp-content/plugins/w3-total-cache/Cdn_Plugin.php on line 1222

    No fix yet?

    Polite bump! Although these are warnings and not errors, they are filling logs and wasting resources, and ideally need addressing as best practice.

    Many thanks.

    Would like to politely bump this too.

    Seems noone to bother, so …

    changing the mentioned line (for me it’s that line with the latest version of W3 Total Cache) 1203 in /wp-content/plugins/w3-total-cache/Cdn_Plugin.php

    from

    if ( count( $this->_replaced_urls ) ) {

    to

    if ( is_array( $this->_replaced_urls ) && count( $this->_replaced_urls ) ) {

    should fix it.

    Best regards,

    Michael

    Plugin Support gidomanders

    (@gidomanders)

    @jaegersnet That’s only a fix to make the warning go away. There’s actually more to it, the real reason the _replaced_urls is not an array in PHP 7.2, but that’s more complicated. We’re working on a solution for the next release.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Parameter must be an array or an object that implements Countable’ is closed to new replies.