Forums › Forums › Search & Filter Pro › Get warning: count(): Parameter must be an array… after upgrading to PHP7
- This topic has 7 replies, 2 voices, and was last updated 6 years, 2 months ago by
Trevor.
-
Anonymous(Private) November 21, 2019 at 2:59 pm #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(Private) November 21, 2019 at 4:35 pm #227234Is 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
Anonymous(Private) November 22, 2019 at 9:02 am #227320Hi 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 -
AuthorPosts