1

I recently noticed we have an error on our List of Link categories page (using Menu Item Type: List All Web Link Categories). There are no errors in the log. We are running php version 7.3.21 and Joomla! 3.9.20. Can anyone help with this?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/milfordu3a/public_html/components/com_weblinks/models/categories.php on line 95
5
  • So is a null result set being generated from a query? Are you able to provide any more diagnostic information?
    – mickmackusa
    Aug 21 '20 at 18:57
  • One query returned 0 rows - there's not enough space in a comment to add it all
    – Kirsten
    Aug 22 '20 at 12:49
  • SELECT ..... FROM jos_fields AS a LEFT JOIN jos_languages AS l ... LEFT JOIN jos_users AS uc ...LEFT JOIN jos_viewlevels AS ag...LEFT JOIN jos_users AS ua ... LEFT JOIN jos_fields_groups AS g ...WHERE a.context = 'com_weblinks.categories' ...
    – Kirsten
    Aug 22 '20 at 12:55
  • I did notice that com_weblinks isn't in any of the tables this query uses so could that be it?
    – Kirsten
    Aug 22 '20 at 12:56
  • Please add all relevant details to your question as an edit.
    – mickmackusa
    Aug 22 '20 at 14:26
3

This is a reported issue which can be seen in the tracker.

Steps to reproduce the issue

  1. Install Weblinks 3.6.0 Package from https://extensions.joomla.org/extensions/extension/official-extensions/weblinks/ on Joomla 3.9.0 using PHP 7.2 and set to report PHP warnings.
  2. Go to Components - Web Links and add any URL as New Web Link to the existing category Uncategorised with default options, Save & Close.
  3. Create a new menu item and select Web Links - List All Web Link Categories with default options, Save & Close.
  4. Go to the front end and select the new link.

Expected result

The list shows the category Uncategorised.

Actual result

Warning: count(): Parameter must be an array or an object that implements Countable in C:\www\joomla380\components\com_weblinks\models\categories.php on line 95

The list shows the category Uncategorised.

System information (as much as possible)

Joomla 3.9.0

PHP 7.2.11

Additional comments

Fixed by inserting the following lines before line 95 in components/com_weblinks/models/categories.php

  if (!is_array($this->_items)) {
      $this->_items = array();
  }

Ref. topic "Weblinks Categories page - Warning: count()" at https://forum.joomla.org/viewtopic.php?f=715&t=967481

2
  • Your post was flagged by the system as Low Quality. Please avoid posting pure hyperlink answers.
    – mickmackusa
    Aug 24 '20 at 3:20
  • Thanks, that fixed it :-)
    – Kirsten
    Aug 24 '20 at 6:57

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .