Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
478 views
in Q2A Core by

[Sat May 08 08:20:06.532910 2021] [proxy_fcgi:error] Got error 'PHP message: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /var/www/VHOST/qa-include/qa-base.php(720) : eval()'d code on line 50

PHP message: PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /var/www/VHOST/qa-include/qa-base.php(720) : eval()'d code on line 25\n'

Using PHP 7.2 

Q2A version: 1.8.6

1 Answer

+1 vote
by

That will almost certainly be from a plugin or theme. Probably the easiest option is to try switching themes, or disable plugins one by one until the error goes away, then that's the one causing the problem. Look for uses of the count() function, you'll need to check that the variable is an array before calling it.

Finding the exact line causing the problem is more tricky due to how Q2A processes plugin code, but you can try uncommenting the line marked "to debug munged code" in either

  • qa-base.php, qa_load_override_files function
  • app/format.php, qa_load_theme_class function
When the page loads it will show the final PHP code used, and the error will be the line listed in your error (50 or 25).
...