Warning: count(): Parameter must be an array or an object that implements Countable in...
I'm getting the above error on the following line.
if (0 >= count($this->xprop))
Can someone help me understand this? I'm fairly new to PHP. The issue is obviously with $this->xprop
not being an array. It wasn't an issue before I upgraded to PHP 7.2. How can I get around this? Are code with warnings still being executed or is this going to cause execution to fail?
I've tried to follow the second answer on here with no luck. The accepted answer is not acceptable to me as it is more of a hack.
Warn when counting non-countable types
– RiggsFolly$this
is? Just because it's in WP doesn't mean it's "WordPress code". Better would be to edit the answer and include the results ofvar_dump($this->xprop)
. Not to dispute RiggsFolly - major props to him - but I actually doubt this is WP core code.... – random_user_name