Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Donut theme shows "Warning: count(): Parameter must be an array..."

+3 votes
290 views
asked Mar 24 in Themes by paulj
Using Donut Theme 1.6.3.1 on Question2Answer 1.8.0 with PHP 7.2.3 I get the following warning:

Warning: count(): Parameter must be an array or an object that implements Countable in ... qa-donut-layer.php on line 1375

(BTW also there is a typo on the Donut Settings page - "Fist box text" instead of First..)

1 Answer

+2 votes
answered Mar 24 by pupi1985
selected Mar 25 by paulj
 
Best answer

I guess this is the line with the issue:

https://github.com/amiyasahu/Donut/blob/23aab78a3837a29b38139af2e61e9c8f7df8c303/qa-theme/Donut-theme/qa-donut-layer.php#L1376

Try replacing it with:

if (
  isset($this->content['widgets'][$region][$place]) &&
  is_array($this->content['widgets'][$region][$place]) &&
  !empty($this->content['widgets'][$region][$place])
) {

It's a bit overkill but will fix the issue.

commented Aug 13 by kelwin
thank you for solution.. pupi1985.. can i get your contact detail for chat /?
commented Aug 13 by pupi1985
You're welcome! Hmm... I don't think so... I think I have enough friends already :P

You can shoot me a private message and see where we get from there.
commented Sep 11 by Ami
I have fixed this in latest version.
...