Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
108 views
in Plugins by
edited by

After upgrading from PHP 7.1. to 7.2 my site started to show warning for each tag (in each question which has one or more of them), which looks very ugly:

Warning: count(): Parameter must be an array or an object that implements Countable in /home/anton800/ask.myfinances.biz/qa-include/qa-base.php(720) : eval()'d code on line 10

The warning is shown both in the questions list and at the question page.

The issue is related to Advanced Tag Descriptions plugin - its file qa-tag-desc-layer.php calls count() on the 10th line:

global
   $plugin_tag_desc_list, 
   $plugin_tag_map;
if (count(@$plugin_tag_desc_list)) {
   $result=qa_db_query_sub(
      'SELECT tag, title, content FROM ^tagmetas WHERE tag IN ($)',
      array_keys($plugin_tag_desc_list)
   );

Is it a known issue? How to resolve it?

A workaround: just remove the plugin (it is not possible to disable it in through the admin panel, so just move its directory elsewhere); anyway it doesn't work as expected (see also #3).

Sample page: https://ask.myfinances.biz/index.php/297/pochemu-ne-poluchaetsya-otkryt-vklad-v-sberbanke-s-karty

Q2A version: 1.8.3

2 Answers

+1 vote
by

Yes it’s an issue with the plugin, you should report it to the developer. But this should also work, replace the 4th line of your example with

if (is_array(@$plugin_tag_desc_list) && count(@$plugin_tag_desc_list)) 
0 votes
by

Here is another solution:

if (count(@(array)$plugin_tag_desc_list)) 
...