Came up with a litte solution for that: Seems that the warning was added in PHP 7.2. From PHP 7.3 there will be a native function called is_countable(). To be compatible with lower PHP versions as well, you could add a little polyfill like function to your plugin, like so:
if (!function_exists('is_countable')) {
function is_countable($c) {
return is_array($c) || $c instanceof Countable;
}
}
With that implemented, you could change the lines in class.petition like so:
if(is_countable($petition)){
if ( count( $petition ) > 0 ) {
$this->_populate_from_query( $petition );
return true;
} else {
return false;
} else {
return false;
}
or something more clever of course 😉 Can’t wait to get my hands on the next update, thanks again for your nice plugin.
Thanks for your contribution.
I have done some research on this and I think that a less complex way to do this is instead of if ( count( $petition ) > 0 ) to use if ( $petition && $petition > 0 )
I have run some tests and it seems to be OK. Can you test it too?
Thanks, will do after my return from Tunisia on Juli 24th.
As far as I can tell this is fixed now. Would appreciate if you can confirm that. I am about to push version 1.13.0