?
avatar okonomiyaki3000
okonomiyaki3000
13 Dec 2014

Steps to reproduce the issue

This part is tricky. You will need two databases and some custom code that is able to operate on both of them. Let's say you create an instance of JTableContent, it registers a JTableObserverTags to handle some stuff related to tags. This, in turn, uses a JHelperTags to store, delete, etc. So, for example, lets say you have two Joomla! installations, A and B. A has a custom component that access B's database, get an instance of JTableContent and manipulate that in some way. When it saves or performs some other observable operation, JHelperTags may be called upon to do something with B's tags but some of its functions will be operating on A's database while others will operate on B's. The most likely result is that you will lose some tag associations from the article you're working on but other, worse issues may also be possible.

Expected result

Well, you'd expect that when you perform some operation on B's content, tag associations will not be lost or corrupted or whatever.

Actual result

You may lose tag associations, you may have other problems.

System information (as much as possible)

Well, not really relevant except that this could only occur if you're working on more than one database.

Additional comments

Yes, I know this is quite obscure. It is, nevertheless, a real issue.

avatar okonomiyaki3000 okonomiyaki3000 - open - 13 Dec 2014
avatar mbabker
mbabker - comment - 13 Dec 2014

Only way around this would be to refactor JHelperTags and its callers so that a JDatabaseDriver instance could optionally be injected (use the one from JFactory if an object isn't injected).

avatar okonomiyaki3000
okonomiyaki3000 - comment - 13 Dec 2014

I think so too but it's not so straight forward. JHelperTags has some functions which take an instance of some JTable class as an argument. In those cases, it probably uses the dbo from the table class. In cases where no JTable is passed in, it uses the default one from JFactory.

If we give JHelperTags its own reference to the dbo that we want it to use, it's obvious that we should use it instead of the default but it's less obvious what to do when a JTable class is being passed in. Hopefully the JTable and JHelperTags will be using the same dbo. If they are not, should we throw an exception or something? Basically nothing good can come of the situation where you create a JHelperTags with a specific dbo but then tell it to operate (in some case) on a JTable with a different dbo. So I think there should be a check for this where applicable and probably an exception should be thrown.

avatar brianteeman brianteeman - change - 15 Dec 2014
Category Tags
avatar brianteeman brianteeman - change - 3 Jan 2015
Labels Added: ?
avatar roland-d
roland-d - comment - 12 Dec 2015

Hello @okonomiyaki3000

Thank you for your contribution.

The last comment here was on December 13, 2014. So the question is, Is this issue/pull request still valid? If so, could you do a pull request for this?

If no reply is received within 4 weeks we will close this issue.

Thanks for understanding!


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

avatar brianteeman brianteeman - change - 12 Dec 2015
Status New Information Required
avatar brianteeman brianteeman - change - 18 Jan 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-01-18 13:19:23
Closed_By brianteeman
avatar brianteeman brianteeman - close - 18 Jan 2016
avatar brianteeman brianteeman - close - 18 Jan 2016
avatar brianteeman
brianteeman - comment - 18 Jan 2016

Closed as per the comment above


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

Add a Comment

Login with GitHub to post a comment