Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Get warning: count(): Parameter must be an array… after upgrading to PHP7

Viewing 8 posts - 1 through 8 (of 8 total)
  • Kirsten Schelper
    #227223

    The full code the warning is refering to (among other places, but always same structur):
    It’s a part of a template that displays a list of projects, created with Search&Filter Pro.

    <?php //non clickable
    $terms = get_the_terms($post->ID, ‘year_of_completion’);
    $count = count($terms);
    if ($count > 0 && ! empty( $terms ) && ! is_wp_error( $terms) ){
    foreach ( $terms as $term ) {
    echo $term->name ;
    }
    }

    I am sorry to say I have no idea how to solve it.. Have tried several things but seems to make things rather worse than better.

    Thanks for your help.

    Best,

    Kirsten

    Trevor Moderator
    #227234

    Is the error in the front or back end?

    Warnings are just that, only warnings. They should not be appearing on a production (i.e. visible to the public) sites. You should set the PHP variable display_errors to OFF (per the PHP manual).

    What version of our plugin are you using, as I am sure we had this issue many versions ago with PHP 7.2 and higher?

    Our current version is 2.4.6

    Kirsten Schelper
    #227320

    Hi Trevor,
    the warning appears in the front end, it’s still on staging (we were testing PHP 7.3).
    Running the WordPress 5.3 and version 2.4.6 of Search&Filter Pro
    I do realize that warning is “just” a warning, but I am kind of worried it might turn into an error in the near future… And would be happy to be able to fix it. 😉
    Best
    Kirsten

    Trevor Moderator
    #227325
    This reply has been marked as private.
    Kirsten Schelper
    #227360

    Sounds great, thanks, Trevor! I’ll try it immediately.
    Best,
    Kirsten

    Trevor Moderator
    #227371

    Ok. I will wait to hear from you.

    Kirsten Schelper
    #227375

    Hi Trevor,
    thanks for trying to help!
    Unfortunately it did not fix my problem, but meanwhile I gained some insights on how to work this out PHP wise.
    Looks like I found a solution myself…
    Thanks so much for your support!

    Best,

    Kirsten

    Trevor Moderator
    #227377

    Thanks for letting me know. I will close this thread for now.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Get warning: count(): Parameter must be an array… after upgrading to PHP7’ is closed to new replies.