J3 Issue ?
avatar ggppdk
ggppdk
23 Feb 2018

Steps to reproduce the issue

In Joomla Tags management

  1. Create a new tag:
    title: ocean
    alias: the-sea

  2. In article form try to add (and then save the form) a tag that causes duplicate alias, try to add a new tag titled:
    the sea

NOTE: the article must not have any other tags just try to add a single tag, the above one

Expected result

You can add tag or you get duplicate tag alias error or some other good feedback

Actual result

You get an SQL syntax error, without any indication of what happened

System information (as much as possible)

Additional comments

Souce code doing the above is

Duplicate alias is found here
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Helper/TagsHelper.php#L260

then here you get a zero size array
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Helper/TagsHelper.php#L71

then here you get an empty SQL clause
https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Helper/TagsHelper.php#L90

This is not a security issue, just an empty SQL clause, making an SQL syntax error, so i report it here

Besides the SQL syntax error
TagsHelper::addTagMapping

also has a really unhelpful return value

it does not return information to the caller of which tags were really created / mapped
it is almost a black box, if we can at least do something in B/C way , e.g. pass by reference an array that is populated with the tags that were successfully added it can become much more useful, also making possible to return error information

avatar ggppdk ggppdk - open - 23 Feb 2018
avatar joomla-cms-bot joomla-cms-bot - change - 23 Feb 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Feb 2018
avatar ggppdk ggppdk - change - 23 Feb 2018
Title
TagsHelper::addTagMapping results in SQL syntax error when tags creation fails e.g. due to duplicate alias
TagsHelper::addTagMapping results in SQL syntax error when all tag creations fail e.g. due to duplicate alias
avatar ggppdk ggppdk - edited - 23 Feb 2018
avatar ggppdk ggppdk - change - 23 Feb 2018
The description was changed
avatar ggppdk ggppdk - edited - 23 Feb 2018
avatar ggppdk
ggppdk - comment - 23 Feb 2018

Please don't make a PR to just return true or false inside TagsHelper::addTagMapping, just for fixing the SQL syntax error.

Can this get a more complete solution like what i am asking in additional comments above ?

avatar franz-wohlkoenig franz-wohlkoenig - change - 23 Feb 2018
Category com_tags
avatar ggppdk ggppdk - change - 23 Feb 2018
The description was changed
avatar ggppdk ggppdk - edited - 23 Feb 2018
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Apr 2018
Status New Discussion
avatar brianteeman
brianteeman - comment - 23 Jul 2018

Can this get a more complete solution like what i am asking in additional comments above ?

If someone writes the code then yes

avatar ggppdk
ggppdk - comment - 23 Jul 2018

I am now using a custom TagsHelper and method that also includes some feedback why the tags were not created

but at least the SQL error can be fixed with this PR: #21239 allowing the form to be saved
about feedback to the user, it can be in some other PR if someone is interested

avatar ggppdk ggppdk - change - 23 Jul 2018
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2018-07-23 20:08:01
Closed_By ggppdk
avatar ggppdk ggppdk - close - 23 Jul 2018

Add a Comment

Login with GitHub to post a comment