Skip to content

mod_weblinks Warning: count(): Parameter must be an array#432

Merged
joomdonation merged 2 commits intojoomla-extensions:masterfrom
ReLater:patch-2
Aug 18, 2021
Merged

mod_weblinks Warning: count(): Parameter must be an array#432
joomdonation merged 2 commits intojoomla-extensions:masterfrom
ReLater:patch-2

Conversation

@ReLater
Copy link
Copy Markdown

@ReLater ReLater commented Feb 17, 2021

Summary of Changes

  • Return always an array instead of NULL if no items found.

Testing Instructions

  • Create a weblinks category without any entries(!).
  • Set up a mod_weblinks for display in frontend and select above new category.

Expected result

  • No PHP warning

Actual result

@ChristineWk
Copy link
Copy Markdown

Could this be closed? #422?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/weblinks/432.

@ReLater
Copy link
Copy Markdown
Author

ReLater commented Mar 23, 2021

My pr is only for the module. Looks like #422 is also talking about the component. Therefore: I don't know.

@BertaOctech
Copy link
Copy Markdown

Hi, I installed com_weblinks 4.0.0-dev in Joomla version, ‎4.0.0-beta8-dev.

I receive an error at administrator/index.php?option=com_categories&extension=com_weblinks

1054 Unknown column 'c.published' in 'field list'

Which com_weblinks should I have installed?


Database Type mysql
10.4.17-MariaDB
utf8mb4_general_ci
utf8mb4_general_ci
None
No
7.3.27
Apache/2.4.46 (Unix) OpenSSL/1.1.1i PHP/7.3.27 mod_perl/2.0.11 Perl/v5.32.1
apache2handler
Joomla! 4.0.0-beta8-dev Development [ Mañana ] 2-February-2021 20:02 GMT
Mozilla/5.0 (X11; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

@joomdonation
Copy link
Copy Markdown
Contributor

@ReLater If you look at the model class, it could return false https://github.com/joomla-extensions/weblinks/blob/master/src/components/com_weblinks/models/category.php#L76 (in case database failure) and for that case, the error still happens.

I updated your PR abit to return empty array for that case. Hope that is OK for you.

@joomdonation
Copy link
Copy Markdown
Contributor

Before patch, there is an error

error

After patch, the error is gone.

So I will merge this PR and we can continue working on other issues. Thanks !

@joomdonation joomdonation merged commit d765eab into joomla-extensions:master Aug 18, 2021
@ReLater ReLater deleted the patch-2 branch August 18, 2021 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants