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
413 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..)

2 Answers

+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 (
  !empty($this->content['widgets'][$region][$place]) &&
  is_array($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.
0 votes
answered Nov 23 by add
reshown Nov 23 by pupi1985
go to qa-theme/Donut-theme/qa-donut-layer.php

and edit line from

if (count($sub_navigation )) {
to
 if ( !empty( $sub_navigation ) ) {
commented Dec 1 by Ami
This has been fixed in 2.0.1 version. thanks for reporting.
...