? Success

User tests: Successful: Unsuccessful:

avatar paul-muckypuddle
paul-muckypuddle
16 Oct 2014

Changed 3rd arg of getTypes call to 'true' to lookup types by alias rather than ID (as per docs) (issue #4655)

Steps to reproduce the issue

1 - Call JHelperTags getTagItemsQuery method with the 2nd argument containing an array of type aliases (as perhttp://api.joomla.org/cms-3/classes/JHelperTags.html#method_getTagItemsQuery

Expected result

A DB object with items matching those tags, filtered by content type

Actual result

Error 1064 (MySQl error)

System information (as much as possible)

Joomla 3.3.6
PHP 5.3

Additional comments

The fix is fairly simple. getTagItemsQuery documentation says it expects the 2nd argument to be an array of content type aliases, a single alias, or null. In fact, because line 560 of JHelperTags calls self::getTypes('assocList', $typesr, false); with the 3rd param as 'false' it actually expects content type IDs, not aliases. Thus, the query causes an error. Changing this to true, or supplying getTagItemsQuery with type IDs, does not cause the issue

avatar muckypuddle muckypuddle - open - 16 Oct 2014
avatar jissues-bot jissues-bot - change - 16 Oct 2014
Labels Added: ?
avatar nicksavov nicksavov - change - 16 Oct 2014
The description was changed
Labels Added: ?
avatar zero-24 zero-24 - change - 16 Oct 2014
Category Libraries Tags
avatar zero-24 zero-24 - change - 16 Oct 2014
The description was changed
Title
Update tags.php
getTagItemsQuery documentation incorrect, arguments causes SQL error
avatar joomdonation
joomdonation - comment - 16 Oct 2014

First of all, I must say that I don't have experience with Tag API (haven't built any extensions use Joomla core tags API yet). However, from a quick look at the code, I think you should correct the documentation instead of correcting the code, the reason is because:

  1. From the code of that method, it is clear that the method expect IDs (integer), not strings.

  2. In TagsModelTag class (Joomla core class), it pass that parameters as array of IDs as well, see the code at

https://github.com/joomla/joomla-cms/blob/staging/components/com_tags/models/tag.php#L196

https://github.com/joomla/joomla-cms/blob/staging/components/com_tags/models/tag.php#L145

So if you fix the code here, you will need to fix the code in TagsModelTag as well.

  1. If there is any third party extensions use this API available at the moment, I believe if they use that method, they must pass the parameters in IDs as well (otherwise, it won't work). So if this PR is merged, the extensions which use this method will be broken (if they use that param).

I might be wrong (as I said, haven't used the API). So if you still want to do this change, maybe we need a developer who has strong experience with Tags API come here and confirm that it works.

avatar muckypuddle
muckypuddle - comment - 16 Oct 2014

Makes sense to change the docs I guess.

avatar muckypuddle muckypuddle - close - 16 Oct 2014
avatar muckypuddle muckypuddle - change - 16 Oct 2014
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2014-10-16 16:07:26
avatar muckypuddle muckypuddle - reopen - 16 Oct 2014
avatar muckypuddle muckypuddle - change - 16 Oct 2014
Status Closed New
avatar muckypuddle
muckypuddle - comment - 16 Oct 2014

Whoops... didn't read that big button.

avatar brianteeman
brianteeman - comment - 18 Oct 2014

As the issue is with the documentation I am asking that you please update the documentation and I am closing this issue

This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/4698.

avatar jissues-bot jissues-bot - close - 18 Oct 2014
avatar brianteeman brianteeman - change - 18 Oct 2014
Status New Closed
avatar jissues-bot
jissues-bot - comment - 18 Oct 2014
avatar jissues-bot jissues-bot - change - 18 Oct 2014
Closed_Date 2014-10-16 16:07:26 2014-10-18 15:22:10

Add a Comment

Login with GitHub to post a comment